DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Question about table name with sysdate pl/sql

  1. #1
    Join Date
    Mar 2009
    Posts
    6

    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

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    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.

  3. #3
    Join Date
    Mar 2009
    Posts
    6

    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

  4. #4
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Quote Originally Posted by The_Oracle View Post
    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.

  5. #5
    Join Date
    Mar 2009
    Posts
    6

    Thank you

    Thanks again. I got it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width