Dapi,
Thanks for that I've now managed to get it to compile, however when I call it. I'm getting an error missing keyword -
Any thoughts?
Error -Call -Code:ORA-00905: missing keyword ORA-06512: at "FCONTDBA.SET_SEQUENCES", line 7 ORA-06512: at line 1Procedure -Code:call Set_Sequences('TL_ID', 'Traffic_Lights')
Code:CREATE OR REPLACE PROCEDURE Set_Sequences (pk_name IN VARCHAR2, table_name IN VARCHAR2) IS max_pk NUMBER; BEGIN EXECUTE IMMEDIATE ('SELECT max('|| pk_name ||') INTO ' || max_pk || ' From ' || table_name); If max_pk = 0 then max_pk :=1; end if; EXECUTE IMMEDIATE ('drop sequence ' || pk_name); EXECUTE IMMEDIATE ('create sequence ' || pk_name || ' start with ' || max_pk || ' increment by 1 min value 1 nocycle cache 20 noorder'); COMMIT; END;




Reply With Quote