Reputation: 1
I have a task to update data to a master table on daily basis, i.e. I'm adding new column called 'TODAY' NUMBER to my master table and successfully writing data but unable to rename column TODAY with SYSDATE
ALTER TABLE DATA_HIST
RENAME COLUMN TODAY TO SYSDATE;
I'm getting invalid identifier error for above script
also tried below with TO_CHAR but unsuccessful
ALTER TABLE DATA_HIST
RENAME COLUMN TODAY TO TO_CHAR(SYSDATE);
Thanks in advance Nash
Upvotes: 0
Views: 450
Reputation: 520958
Escape the column name with double quotes:
ALTER TABLE DATA_HIST
RENAME COLUMN TODAY TO "SYSDATE";
But in general you should avoid naming your tables and columns after keywords or system function names.
Upvotes: 4