Yurttas/PL/DBL/oracle/F/02/Bank/Customer-def.sp
Jump to navigation
Jump to search
1/*
2REM
3REM
4REM Customer-def.sap
5REM
6REM
7*/
8
9DECLARE
10
11 cursor_handle INTEGER;
12
13 customer_created INTEGER;
14
15BEGIN
16
17 cursor_handle := DBMS_SQL.OPEN_CURSOR;
18
19 DBMS_SQL.PARSE(cursor_handle,
20 'CREATE TABLE Customer(customername VARCHAR2(16) NOT NULL,'||
21 'street VARCHAR2(10), '||
22 'customercity VARCHAR2(16), '||
23 'PRIMARY KEY(customername))',
24 DBMS_SQL.V7);
25
26 customer_created := DBMS_SQL.EXECUTE(cursor_handle);
27
28 DBMS_SQL.CLOSE_CURSOR(cursor_handle);
29
30 DBMS_OUTPUT.PUT_LINE('Table ''Customer'' created Successfully');
31
32EXCEPTION
33 WHEN OTHERS
34 THEN
35 DBMS_SQL.CLOSE_CURSOR(cursor_handle);
36 DBMS_OUTPUT.PUT_LINE('Table ''Customer'' cannot be created;');
37 DBMS_OUTPUT.PUT_LINE('Table ''Customer'' might be already existing.');
38
39END;
40/