Passing parameter to sqlplus script [message #674400] |
Fri, 25 January 2019 05:06 |
ramya29p
Messages: 146 Registered: November 2007 Location: Chennai
|
Senior Member |
|
|
Hi,
I want to pass parameter to the .sql file via sqlplus script for connecting the Database.
I have created a batch file having below script.
sqlplus /nolog @schema_compile.sql
schema_compile.sql file with below script
conn schema_name
sho user
exec dbms_utility.compile_schema('schema_name',FALSE)
I tried passing the parameter, but it did not work.
sqlplus /nolog @schema_compile.sql schema_name
schema_compile.sql file with below script
conn &1
sho user
exec dbms_utility.compile_schema('&1',FALSE)
Could anyone please help me.
|
|
|
|
|
|
|
|
Re: Passing parameter to sqlplus script [message #675422 is a reply to message #675420] |
Thu, 28 March 2019 08:22 |
|
JPBoileau
Messages: 88 Registered: September 2017
|
Member |
|
|
Here you go.
C:\jp>more testscript.sql
connect &1/&2@&3
select '&4' from dual;
exit
C:\jp>sqlplus /nolog @testscript.sql jboileau password dev1 "hello world"
SQL*Plus: Release 18.0.0.0.0 Production on Thu Mar 28 09:20:03 2019
Version 18.2.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Connected.
old 1: select '&4' from dual
new 1: select 'hello world' from dual
'HELLOWORLD
-----------
hello world
JP
|
|
|