oracle - How do I pass arguments to a PL/SQL script on command line with SQLPLUS? -


how pass arguments pl/sql script on command line sqlplus? can call pl/sql script so, script requires arguments in order succeed. how can run sqlplus.exe can pass arguments script?

@echo off // host030 tnsnames alias machine, port, , instance     sqlplus.exe myuser/mypassword@host030 < refreshdataonoracle.sql     pause 

i tried search answer couldn't find "argument example" anywhere sqlplus. suspect similar method of using sql*plus "start" command?

firstly, need invoke script so:

sqlplus.exe myuser/mypassword@host030 @refreshdataonoracle.sql foo bar   

instead of os redirection use "@" symbol indicate file name execute. supply script parameters on command line. in script refer parameters using &1, &2 etc.

update mytable set mycol = '&2' myid = '&1'; 

which translate

update mytable set mycol = 'bar' myid = 'foo'; 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -