-
Question about table name with sysdate pl/sql
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.
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
Thank you
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
-
Originally Posted by The_Oracle
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:
Code:
select 'MYTABLE_' ||
to_char(sysdate, 'YYYYMMDD') as "TABLENAME"
from dual;
... do you get the idea??
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|