Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: can a .sql file take parameters?
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 replace &1 etc. prior to trying to execute the SQL statement, so you need to 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 @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 CDT
![]() |
![]() |