Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Sv: getting a count of arguments

Sv: getting a count of arguments

From: Allan Saadbye <isl34485_at_image.dk>
Date: Fri, 9 Jul 1999 20:27:56 +0200
Message-ID: <Kerh3.1809$K4.36635@news020.image.dk>


Hello Sarah,

The scripts Im used to write are typically writen to be run on a unix user and the parameter check are therefore made in UNIX. If you have access to unix shell, this sample script migth help othewise it wont!

#########################################
#             Sample script

#
#########################################
unset sqlscipt
sqlscript () {
sqlplus / -s / <<END >/dev/null
REM Here your sqlscript is entered.
REM Parameter check is done in unix later on REM I've have inserted a samlescript
spool /tmp/fname
select * from emp
where empname=$name
/
spool off
END
}
foo$1

case $foo in

Sarah) name="Sarah" ;;

*) echo "\10*>"

    echo 'The name is wrong!'
    echo 'The name are Sarah'
    exit ;;
esac
echo ' The list is underway'
sqlscript
# this invokes the procedure sqlscript () lp -d$2 -s -c -off /tmp/fname.lst
rm /tmp/fname.lst
#this cleans up

With this script I can call the scipt bye entering: script Sarah Printername

This can even be called bye the cron in unix to be executed at none workhours.

wiht regards Allan

Sarah Officer <officers_at_aries.tucson.saic.com> skrev i en nyhedsmeddelelse:378623AA.23EF2D09_at_aries.tucson.saic.com...
> I have created a sql script that can be invoked by START. It
> requires a couple arguments, which I reference in the script by
> using &1, &2, ... I would like to put a statement at the top of my
> sql script which exits with a message if the exact number of
> arguments is not given; something like

>

> if(#* != 3)
> prompt "This script requires three arguments:"
> prompt " foo - the first arg"
> prompt " bar - the second arg"
> prompt " baz - the third arg"
> exit
> endif;
> >
> create ....
> insert ....where '&1'...and '&2'... and '3' ....
>
> exit
> >

> How can I write this in sql? Can I get the number of arguments and
> compare it to a desired value?
>

> Thanks,
>

> Sarah Officer
> officers_at_aries.tucson.saic.com
Received on Fri Jul 09 1999 - 13:27:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US