Link to home
Create AccountLog in
Avatar of enrique_aeo
enrique_aeo

asked on

parameters in the shell? order

i have this store procedure
PROCEDURE SP_EXTRAE_DEV(  
          PI_USUARIO IN VARCHAR2,
          PI_FECHA_DEVOLUCION_INI IN VARCHAR2,
          PI_FECHA_DEVOLUCION_FIN IN VARCHAR2,
          PI_MSISDN IN VARCHAR2,          
         codError OUT NUMBER,
          desError OUT VARCHAR2 ) IS

There are several scenarios when called from the Shell
 1. If I send a parameter from Shell brings information from the previous day, this is controlled by the sp and works well
2. If you want to send a date range I run this way and works well
sh nameSHELL 20111011 20111011
3.
My question is how do I make the call to Shell if I just want to send the pi_msisdn, try to do so:
sh nameshell null null 511997274580 but it is not work

this is the code in the shell
if [[ -z $1 ]]
then
           #do something
           USER_SERV=`whoami`
else
            PI_FECHA_DEVOLUCION_INI=$1
            PI_FECHA_DEVOLUCION_FIN=$2
fi
#MSISDN
if [[ -z $3 ]]
then
           #do something
            USER_SERV=`whoami`
else
            PI_MSISDN=$3
fi

Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

try:
sh nameshell "" "" 511997274580


From your previous question this is why I kept asking about the number and position of the parameters and you never answered.

In that question getopts was mentioned.

I would use it, then the order and number doesn't matter.

for example:
sh nameshell -s 20111011 -e 20111011 -p 511997274580
sh nameshell -p 511997274580
etc...


There are many examples out there on getopts and shell scripts

Here is the first one I cam across:
http://www.mkssoftware.com/docs/man1/getopts.1.asp
Hi

You should run the procedure as following:


PROCEDURE SP_EXTRAE_DEV( PI_USUARIO=>null,PI_FECHA_DEVOLUCION_INI=>null, PI_FECHA_DEVOLUCION_FIN =>null, PI_MSISDN=>511997274580,ou1,ou2);

Regards,
Jarek
Avatar of enrique_aeo

ASKER

the page
http://www.mkssoftware.com/docs/man1/getopts.1.asp 
it is not working, another please?
>>it is not working, another please?

Define not working.

If you are trying to implement getopts, please provide a simple sample, not your complete code, shell script that shows the errors you are receiving.
the message is
Internet Explorer cannot display the webpage
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer