Yurttas/PL/DBL/oracle/F/02/Bank/u01.sp

From ZCubes Wiki
Jump to navigation Jump to search
 1CREATE OR REPLACE
 2PROCEDURE u01 IS
 3
 4  cursor_handle INTEGER;
 5
 6  borrower_deleted INTEGER;
 7
 8BEGIN
 9
10  DBMS_OUTPUT.PUT('Deleting all tuples from the Borrower table...');
11  
12  cursor_handle := DBMS_SQL.OPEN_CURSOR;
13
14  DBMS_SQL.PARSE(cursor_handle, 
15                 'DELETE FROM Borrower',
16                 DBMS_SQL.V7);
17
18  borrower_deleted := DBMS_SQL.EXECUTE(cursor_handle);
19
20  DBMS_SQL.CLOSE_CURSOR(cursor_handle);
21
22  DBMS_OUTPUT.PUT_LINE('Done.');
23
24EXCEPTION
25  WHEN OTHERS
26  THEN
27    DBMS_SQL.CLOSE_CURSOR(cursor_handle);
28    DBMS_OUTPUT.PUT_LINE('Error deleting all tuples from the Borrower table.');
29
30END;
31/