CREATE PROCEDURE A(tab IN <table - what should I write here?>) AS
BEGIN
INSERT INTO tab VALUES(123);
END A;
How can I specify that the parameter tab
is a table name?
CREATE PROCEDURE A(tab IN <table - what should I write here?>) AS
BEGIN
INSERT INTO tab VALUES(123);
END A;
How can I specify that the parameter tab
is a table name?
You can't. Instead you need to pass it in as a VARCHAR2 string and then use Dynamic SQL:
CREATE PROCEDURE A(tab IN VARCHAR2) AS
BEGIN
EXECUTE IMMEDIATE 'INSERT INTO ' || tab || 'VALUES(123)';
END A;
Read up about Dynamic SQL and be aware of the issues it can bring if used unwisely, such as poorer performance, scalability and security.