Re: can a .sql file take parameters?

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: 1998/09/24
Message-ID: <6udq1b$eqp$1_at_pascal.a2000.nl>#1/1


Thenardier wrote
>as title. than how can i do it? if not, what should i do?

Yes, &1 will give you the first parameter, &2 the second, etc. SQL*Plus will [Quoted] replace &1 etc. prior to trying to execute the SQL statement, so you need to [Quoted] include quotes etc. Like:

    select table_name
    from all_tables
    where owner = upper ( '&1' );

You can call this script, when named my_script.sql, using

    SQL> start my_script.sql scott

or

    $> sqlplus scott/tiger _at_my_script.sql scott

If you ommit the parameter values, SQL*Plus will ask for them.

Arjan. Received on Thu Sep 24 1998 - 00:00:00 CEST

Original text of this message