Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Optional Prompting for Parameters

Re: Optional Prompting for Parameters

From: OneMan <om_at_nospam.org>
Date: Fri, 15 Jun 2007 16:17:34 +0100
Message-ID: <MPG.20dcbde498305db4989683@news.plus.net>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US