I have a table which has the structure as shown below:
SALES_RECS
---------------------------------------------------------------------
| DEPT | LOCATION | NUMBER1 | NUMBER2 | NUMBER3 | NUMBER4 | NUMBER5 |
---------------------------------------------------------------------
I have a procedure wherein I would be inserting data into this table. But while inserting the data I need to choose between column NUMBER1 to NUMBER5 based on certain criteria. So I have set this column to be chosen dynamically as shown below:
-- BELOW VALUE WOULD BE RETRIEVED DYNAMICALLY
num_val := 4
INSERT INTO SALES_RECS(DEPT, LOCATION, NUMBER||num_val)
VALUES ('CC', 'HOUSTON', 5000);
I'm getting the following error as listed below:
PL/SQL: ORA-01747: invalid user.table.column, table.column, or column specification
I'm not sure, how to choose/set the column name dynamically within the insert statement.
Thank you so much for your time and help in advance!