I am working on an pl/sql use case where I need to create a trigger for the "Create" and inside the trigger it again Creates a table. Is there a way I can set the recursion level to 1 similar to sql-server in Oracle db. Please suggest
Edit:
Adding the trigger and the create table command
CREATE TRIGGER abc
AFTER CREATE ON DATABASE
BEGIN
IF TRIGGER_NESTLEVEL() <= 1 THEN
EXECUTE IMMEDIATE
'CREATE TABLE dep (
dep_id NUMBER(4) NOT NULL,
dep_nm VARCHAR2(30),
c_id NUMBER(4) NOT NULL)
PARTITION BY HASH(dep_id)
(PARTITION t1 tablespace tbs2)';
EXECUTE IMMEDIATE
'CREATE TABLE dep_temp AS SELECT * from dep where 1=2';
EXECUTE IMMEDIATE
'ALTER TABLE dep
EXCHANGE PARTITION t1
WITH TABLE dep_temp
WITHOUT VALIDATION
UPDATE GLOBAL INDEXES';
EXECUTE IMMEDIATE
'create table t1_temp for exchange with table dep';
EXECUTE IMMEDIATE
'ALTER TABLE dep
EXCHANGE PARTITION t1
WITH TABLE t1_temp
WITHOUT VALIDATION';
END IF;
END;
/
CREATE TABLE dep3(
dep_id NUMBER(4) NOT NULL,
dep_nm VARCHAR2(30),
c_id NUMBER(4) NOT NULL);