How to pass arg to script?

Jorge wrote in message <[email protected]>...
>Hi:
>    Can I request data from users to generate a script??
>
>Ex:
>
>    I have a bat file:
>            @echo on
>            svrmgr30 @global.sql
>    And the script file
>            connect system/manager
>            alter database rename global_name to ' VAR1 '
>
>    Can I request var1 from the command line?? or maybe how can
I pass
>parameters to my scripts files???
>
>THANKS
>
>
>
 

Answer 1:

Hi Jorge,

    Try the following:

               connect system/manager
             alter database rename global_name to '&1 ';

    The substitution character is &.  &1 is the first parameter,
&2 the second parameter, etc.

    The general form for invoking a SQL*Plus script from the OS
command line is:

                sqlplus <user>/<password> @script argument1
argument2
 

regards
Jerry Gitomer

Answer 2:

Use Command Line Arguements within  the Script like this :
Global.sh
---------
svrmgrl << EOF
connect internal;
alter database rename global_name to '$1';
exit
EOF

Execute from Unix Command Line like
$./global.sh <Name>

-Thiru
 

Hosted by www.Geocities.ws

1