Create Table-Script (inkl. DROP und Abfangen des ORA-942)
Blueprint für Create Table-Script (inkl. DROP und Abfangen des ORA-942)
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE myTab';
EXCEPTION
WHEN OTHERS
THEN
IF SQLCODE = -942
THEN
NULL;
ELSE
RAISE;
END IF;
END;
/
CREATE TABLE myTab
(
P_KEY NUMBER NOT NULL,
myTab_KEY NUMBER NOT NULL,
myTab2_KEY NUMBER NOT NULL,
myNr NUMBER (1),
myStr VARCHAR2 (100 CHAR),
CONSTRAINT myTab_PK PRIMARY KEY (P_KEY, myTab_KEY) USING INDEX LOCAL,
CONSTRAINT myTab_UK PRIMARY KEY (P_KEY, myNr) USING INDEX LOCAL,
CONSTRAINT myTab_FK1 FOREIGN KEY (P_KEY, myTab2_KEY)
REFERENCES myTab2 (P_KEY, myTab2_KEY)
)
TABLESPACE TS_MYDATA
LOGGING
PARTITION BY LIST (P_KEY)(PARTITION P_0 VALUES (0) LOGGING COMPRESS BASIC TABLESPACE TS_MYDATA)
COMPRESS BASIC
MONITORING;
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE myTab';
EXCEPTION
WHEN OTHERS
THEN
IF SQLCODE = -942
THEN
NULL;
ELSE
RAISE;
END IF;
END;
/
CREATE TABLE myTab
(
P_KEY NUMBER NOT NULL,
myTab_KEY NUMBER NOT NULL,
myTab2_KEY NUMBER NOT NULL,
myNr NUMBER (1),
myStr VARCHAR2 (100 CHAR),
CONSTRAINT myTab_PK PRIMARY KEY (P_KEY, myTab_KEY) USING INDEX LOCAL,
CONSTRAINT myTab_UK PRIMARY KEY (P_KEY, myNr) USING INDEX LOCAL,
CONSTRAINT myTab_FK1 FOREIGN KEY (P_KEY, myTab2_KEY)
REFERENCES myTab2 (P_KEY, myTab2_KEY)
)
TABLESPACE TS_MYDATA
LOGGING
PARTITION BY LIST (P_KEY)(PARTITION P_0 VALUES (0) LOGGING COMPRESS BASIC TABLESPACE TS_MYDATA)
COMPRESS BASIC
MONITORING;
Kommentare
Kommentar veröffentlichen