mudah2an maksudnya begini..

begin
  select id, nama
  from mahasiswa
  where id =:nama_block.id;
  
  update mahasiswa
  set name='Tukiyem'
  where id =:nama_block.id;
    
exception when no_data_found then
insert into mahasiswa(id,nama)
values(:nama_block.id,:nama_block.nama);
end;

jadi kalo secara logika dari procedure(mudah2an bener
ya) diatas :
di select dulu terus kalo ketemu dia akan update
terus kalo gak ketemu dia akan masuk ke exception.

semoga membantu..

--- Jemmy <[EMAIL PROTECTED]> wrote:

> Halo...
> Numpang tanya, bagaimana caranya kalo di Oracle saya
> ingin mengeksekusi query dengan logika sebagai
> berikut:
> 
> If exist then
>   update
> else
>   insert new
> end if
> 
> Jadi, kalo data yang akan disave sudah ada, maka
> secara otomatis akan diupdate, kalo tidak ada baru
> insert new.
> 
> Hasil googling ketemu pake statement MERGE, tapi
> setelah saya coba gak berhasil, bahkan error.
> 
> Thx b4.
> 
> 
> 
> 
> Jemmy H. Tecoalu
> Personal blog: http://jemmyt.blogspot.com
> 
> "The present was affected by the past, and the
> present will affect the future."
> 
> 
>  
> ---------------------------------
> Sucker-punch spam with award-winning protection.
>  Try the free Yahoo! Mail Beta.
> 
> [Non-text portions of this message have been
> removed]
> 
> 



      
____________________________________________________________________________________
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

Kirim email ke