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