1 / 13

CURSORS

CURSORS. Nama kelompok 10 Rizka Annisa 1135010045 Riris Arista 1135010047 Yolanda Yuspitasari 1135010060 Rashyandri A 1135010061. CURSORS. Cursors : sejenis variabel untuk menampung lebih dari satu baris data. Dua tipe dari Cursors :

collin
Download Presentation

CURSORS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CURSORS Namakelompok 10 RizkaAnnisa 1135010045 RirisArista 1135010047 Yolanda Yuspitasari 1135010060 Rashyandri A 1135010061

  2. CURSORS • Cursors : sejenisvariabeluntukmenampunglebihdarisatubaris data. • Duatipedari Cursors : • Implicit Cursor (tidakdapatdikendalikanoleh programmer) • Explicit Cursor (dideklarasikanoleh programmer)

  3. Berikut ini tabel yang memberikan keterangan perbedaan antara Kursor Eksplisit dan Kursor Implisit :

  4. Membuat Cursor Syntax: • select_statementyang dimaksudadalahsebuah query. • Jikamembutuhkanbarisygspesifik, gunakanklausa ORDER BY didlm query. CURSOR cursor_name IS select_statement;

  5. Contoh : DECLARE CURSOR emp_cursor IS SELECT employee_id, last_name FROM employees; CURSOR dept_cursor IS SELECT * FROM departments WHERE location_id = 170; BEGIN ...

  6. MembukaKursor Syntax: • Kursordibukauntukmengeksekusi query danmengenalibagianygaktif. • Gunakanatributkursoruntuk test padahasilsetelahmengambilisikursor. OPEN cursor_name;

  7. MengambilIsiKursor • Syntax: • Untukmengambilisikursordanmenampilkandgnprosedur PUT_LINE gunakan statement FETCH. • Mendapatkankembali value daribariskedalamvariabel. • Tipe data darivariabelharussamadengantipe data daritabel FETCH cursor_name INTO [variable1, variable2, . . .] | record_name];

  8. MenutupKursor • Syntax: • Tutupkursorsetelahselesaimemanipulasinya. • Bukakembalikursor, kldiperlukan. • Tidakmengambilisikursorsetelahkursorditutup CLOSE cursor_name;

  9. Implicit Cursor Syntax: select [daftar kolom] into [daftar variabel] from [daftar tabel] where [syarat] contoh: select first_name, last_name, salaryinto nama_depan, nama_belakang, gaji from employees where first_name = ‘Susan’;

  10. contoh: Declare nama_cari employees.first_name%type; nama_depan employees.first_name%type; alamat_email employees.email%type; telepon employees.phone_number%type; Begin nama_cari := '&masukkan_nama'; select first_name, email, phone_number into nama_depan, alamat_email, telepon from employees where first_name = nama_cari; dbms_output.put_line('Nama:'||nama_depan);dbms_output.put_line('Email:'||alamat_email||'@SemogaJaya.co.id'); dbms_output.put_line('Telepon: '||telepon); end; /

  11. Prosentase • RizkaAnnisa1135010045 (25%) • Riris Arista 1135010047 (25%) • Yolanda Yuspitasari1135010060 (25%) • Rashyandri A 1135010061 (25%)

  12. Refrensi • http://chlorophilia.wordpress.com/2010/10/21/membuat-cursor-pada-oracle-10g/ • http://cisku.com/?p=129

  13. Terimakasih

More Related