Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Optional Prompting for Parameters
In article <1181852233.994342.4530_at_x35g2000prf.googlegroups.com>,
faceman28208_at_yahoo.com says...
> I would like to have an SQL script that will prompt for parameters
> that are not given.
>
> If I do
>
> @test 10
>
> it will run silently.
>
> If i do
>
> @test
>
> It will respond
>
> Enter Employee ID:
>
> How might one do this?
The following will let you call the script with parameters or prompt you if left out:
e.g.
set echo on
def pdate = &1 /* p1: date (ddmmyy) */
set echo off
SELECT TO_CHAR( TO_DATE('&pdate', 'ddmmyy'), 'dd-Mon-rrrr') AS mydate
FROM DUAL;
undef 1
undef pdate
Received on Fri Jun 15 2007 - 10:17:34 CDT