Yurttas/PL/DBL/oracle/F/02/PC/Printer-def.sp
Revision as of 23:29, 4 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="text" line start="1" enclose="div"> →REM REM REM Printer-def.sp REM REM: DECLARE cursor_handle INTEGER; printer_created INTEGER; BEGIN cu...")
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/