Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Procedure with undefinined argument number
A copy of this was sent to "B. Lelangue" <lelangue_at_sia.ucl.ac.be> (if that email address didn't require changing) On Fri, 20 Mar 1998 11:18:39 +0100, you wrote:
>Does anyone know if you can create PL/SQL procedures
>without define the number of it's argument ?
>
>--------------------------------
>I want to do this
>
>begin
>...
>htp.formopen(MYPROC);
>for RECORD in CURSOR (MYARG) loop
> htp.formcheckbox(CNAME,VALUE,CHECKED);
> htp.nl;
>end loop;
>htp.formsubmit;
>...
>
>I don't know how to define MYPROC.
>
>note:
>1° I can't predict the number of rows in the FETCH
>2° I can't predict the number of checkboxes checked by the user
>and thus the number of arguments that MYPROC will receive.
>
Instead of creating a form that looks like:
<input type=checkbox name=field1 value=value1> <input type=checkbox name=field2 value=value2> <input type=checkbox name=field3 value=value3>...
which would force you to have input parameters field1, field2, field3, ....
create a form like:
<input type=hidden name=the_Checkboxes value=dummy> <input type=checkbox name=the_Checkboxes value=field1_value1> <input type=checkbox name=the_Checkboxes value=field2_value3> <input type=checkbox name=the_Checkboxes value=field3_value3>...
(concat the NAME with the VALUE and put a separator between them). Your accepting procedure could look like:
create procedure foo( the_Checkboxes in owa.vc_arr ) is
n number;
begin
for i in 2 .. 100000 loop
begin
n := instr( the_Checkboxes(i), '_' ); htp.p( 'You selected ' || substr(the_checkBoxes(i),1,n-1) ) || ' with a value of ' || substr(the_checkBoxes(i),n+1) ); exception when no_data_found then exit;
If the checkbox is checked, the browser will send the value FIELDNAME_VALUE (if not checked it will not send it). The pl/sql agent will pack all same named fields into a pl/sql table which you can then loop over...
>TIA
>B Lelangue, lelangue_at_sia.ucl.ac.be,
>Université Catholique de Louvain la Neuve, Belgium
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Mar 20 1998 - 00:00:00 CST
![]() |
![]() |