I've written a procedure to update the sequences in my DB. I'm getting an error when I compile it. Says the identifier 'table_name' must be declared, which it is as an input param. Does anyone know what the probem might be, and how to fix it?
Error -
Code:
PROCEDURE FCONTDBA.SET_SEQUENCES
On line: 7
PLS-00201: identifier 'TABLE_NAME' must be declared
Procedure -
Code:
CREATE Or REPLACE PROCEDURE Set_Sequences (pk_name In VARCHAR2, table_name In VARCHAR2) IS
max_pk NUMBER;
BEGIN
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;
Regards Allan