Home » SQL & PL/SQL » Client Tools » How to pass date dynamically in prompt. (oracle 10.G)
How to pass date dynamically in prompt. [message #418641] Mon, 17 August 2009 23:46 Go to next message
deep0983
Messages: 28
Registered: April 2009
Junior Member
Hi All,

i need to display the below statement.
PROMPT '-----Backup tables ABC_20090818 and DEF_20090818 will be created -----------'

I have created a sql file and when it will run the above message should display at beggining.

The problem is i want to display Table name and today's date in YYYYMMDD format like ABC_20090818.

Can annybody help me how to create dynamically the date so that it will display the date according to today's date.

i tried with sysdate but i dont know how to pass the varibale in above statement.

Please help me out.

Regards
Deep
Re: How to pass date dynamically in prompt. [message #418644 is a reply to message #418641] Mon, 17 August 2009 23:56 Go to previous messageGo to next message
BlackSwan
Messages: 21949
Registered: January 2009
Senior Member
>The problem is i want to display Table name and today's date in YYYYMMDD format like ABC_20090818.

BAD idea & does not conform to Third Normal Form.
The date should be a field within table & not part of table name!
Re: How to pass date dynamically in prompt. [message #418651 is a reply to message #418641] Tue, 18 August 2009 00:18 Go to previous messageGo to next message
Michel Cadot
Messages: 57612
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> host type t.sql
set termout off
col dt new_value dt
select to_char(sysdate,'YYYYMMDD') dt from dual;
set termout on
prompt Backing table TAB_&dt....

SQL> @t.sql
Backing table TAB_20090818...

Regards
Michel
Re: How to pass date dynamically in prompt. [message #418656 is a reply to message #418651] Tue, 18 August 2009 00:34 Go to previous message
deep0983
Messages: 28
Registered: April 2009
Junior Member
Hi Michel,

Thanks a lot for your help.

Regards
Deep
Previous Topic: SQL PLUS set echo off command
Next Topic: Please help
Goto Forum:
  


Current Time: Sun Apr 20 00:26:02 CDT 2014

Total time taken to generate the page: 0.13631 seconds