Advertisement
Shailrshah

Using Cursors to Print Details of Customers

Oct 27th, 2013
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.42 KB | None | 0 0
  1. DECLARE
  2.     CURSOR CURSOR IS SELECT * FROM cust;
  3.     cust cursor%ROWTYPE;
  4. BEGIN
  5.     DBMS_OUTPUT.PUT_LINE('*********************************');
  6.     OPEN CURSOR;
  7.     FETCH CURSOR INTO cust;
  8.     WHILE cursor%found LOOP
  9.         DBMS_OUTPUT.PUT_LINE(cust.fname||' '|| cust.lname ||'('||cust.area||')'||': '|| cust.phone_no);
  10.         DBMS_OUTPUT.PUT_LINE('*********************************');
  11.         FETCH CURSOR INTO cust;
  12.     END LOOP;
  13.     CLOSE CURSOR;
  14. END;
  15. /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement