Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompting for Parameter

Status
Not open for further replies.

asth01

Programmer
Jan 18, 2004
36
US
Hi,

Is there a way to prompt users to provide a date value for a parameter in procedure?
Also, I want that the date value to be "treated" in format of DD-MON-YYYY. Users will enter in this format e.g.
12-MAR-1901.

Thanks,
 
Asth,

In direct answer to your question, if you are doing this all in SQL*Plus, then here is some code:
Code:
SQL> create or replace procedure NextDay (date_in in date) is
  2  begin
  3   dbms_output.put_line('Tomorrow will be: '||to_char(date_in+1,'dd-mon-yyyy')||'.');
  4  end;
  5  /

Procedure created.

SQL> accept x prompt "Enter some date (e.g. 'DD-MON-YYYY'): "
Enter some date (e.g. 'DD-MON-YYYY'): 12-MAR-1901

SQL> exec NextDay(to_date('&x','DD-MON-YYYY'))
Tomorrow will be: 13-mar-1901.
[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 07:36 (11Feb04) UTC (aka "GMT" and "Zulu"), 00:36 (11Feb04) Mountain Time)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top