I’ve been using the Oracle SQL Developer Data Modeler to create a relational model of our database. We needed a auto incrementing ID in our of our tables, so I’ve created a script to be placed in the Table Properties > Scripts > After Create section. But the problem I’m having is needing to change the name of the database, sequence and trigger for every table.
So if we had to rename the table in anyway, it becomes a hassle to go and change the script.
I am wondering is there a way to reference the table name from the script area? Like a variable, template or placeholder?
Here’s a sample of my script:
CREATE SEQUENCE table_Seq
START WITH 1
INCREMENT BY 1;
CREATE OR REPLACE TRIGGER table_Trigger
BEFORE INSERT
ON table
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT table_Seq.nextval INTO :NEW.ID FROM dual;
END;
/
Thanks
I’ve solved this problem after figuring out there was a build-in function in Oracle SQL Developer Data Modeler to handle Sequence and Triggers.
To access this interface…