cursor

Sql code posted by Daniel
created at 22 Jul 09:08

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
declare
  noM number;
    noS number;
    V_count integer := 1;    
    cursor cur is
      select ts.NOMOR_MAHASISWA,
               sek.NOMOR
       from siska.TEMP_SEKOLAH ts
      join siska.SEKOLAH sek on ts.SMU = sek.NAMA_SEKOLAH;
     
begin
  open cur;
  loop
  fetch cur into noM, noS;
    exit when cur%NOTFOUND;
  
  update 
       siska.GABUNGAN
    set 
       nomor_sekolah = nos
    where 
       nomor_mahasiswa = noM;
    
    
  end loop;
    commit;
    close cur;
end;
503 Bytes in 2 ms with coderay