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

Home -> Community -> Usenet -> c.d.o.server -> Re: Can we pass variable paramaters to a procedure?

Re: Can we pass variable paramaters to a procedure?

From: <bonanos_at_yahoo.com>
Date: Tue, 20 Apr 1999 06:19:41 GMT
Message-ID: <7fh69n$t6i$1@nnrp1.dejanews.com>

> For those of you who are familiar with C programming, you can check the
> number of arguments to a function with the help of argc/argv. I was
> wondering if there is some way to do a similar thing for an Oracle
> procedure?
>
> Can I set the number of parameters that a procedure accepts as variable and
> then within the procedure count the number of actual values entered by the
> user?

Hi,

Yes you can send multiple parameters to a function.

You declare the following in a package:

type vc_arr is table of varchar2(200) index by binary_integer;

then you use this in the procedure you are writing:

create or replace procedure my_proc (parms in package_i_declared_in.vc_arr) as

last_val varchar2(10);
i number default 1;

BEGIN last_val :=parms.count; --this gives you the number of variables

and you access variables like this:
parms(1) etc.

obviously if you wanted the name of the parameter as well you would have two such vraiables one for the name the other for the value.

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Apr 20 1999 - 01:19:41 CDT

Original text of this message

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