I am attempting to create a table with pl/sql where the table name has sysdate (current date) in the name (i.e my_table_sysdate). I need to re-create this table weekly with new data and append the date to the table name. Please help
Printable View
I am attempting to create a table with pl/sql where the table name has sysdate (current date) in the name (i.e my_table_sysdate). I need to re-create this table weekly with new data and append the date to the table name. Please help
Dynamic sql would do it.
Build your command line as dynamic sql then execute immediate.
Thanks for the quick reply. Therefore I can issue a create table my_tablename_sysdate at a command line and execute immediate and it will create a table with sysdate in the table name. Just to clarify
No.
You can build a command line resorting to dynamic sql, include date on your table name then execute immediate the command line and you will create a table with sysdate as part of the name.
I'm not doing your job for you but... take a look at this:
... do you get the idea??Code:select 'MYTABLE_' ||
to_char(sysdate, 'YYYYMMDD') as "TABLENAME"
from dual;
Thanks again. I got it.