• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8590
  • Last Modified:

Oracle plsql web toolkit and passing array values problems.

How would a person pass the values in this array to another procedure in the package?  I see the values passing in the address line (via web browser) but it appears the procedure doesn't know what to do with them!  This is new to me and any help would be great - Here is a sample of how it is set up:

CREATE or REPLACE PACKAGE test_htp_arrays AS

    TYPE seq_no_array is varray(7) of NUMBER(7);

  PROCEDURE p_recommendations;
                                                      -- Academic Reviewer Workarea
  PROCEDURE p_create_contract(pidm NUMBER DEFAULT NULL, a_seq_no seq_no_array DEFAULT NULL,
    cntr NUMBER DEFAULT NULL);
                                                      -- This is the procedure that creates the contract

END test_htp_arrays;
/
show errors

CREATE or REPLACE PACKAGE BODY test_htp_arrays AS

  PROCEDURE p_recommendations IS
    -- Workarea for the Academic Reviewer
 
    cntr NUMBER(5);
    pidm NUMBER(8);
    v_seq_no dbms_sql.number_table;
    a_seq_no seq_no_array := seq_no_array();
 
  BEGIN
    htp.htmlopen;
    htp.headopen;
      htp.title('testing arrays part one');
    htp.headclose;
    htp.bodyopen;
      htp.header(1,'Testing arrays part one');
    htp.formopen('https://aragorn.plymouth.edu:8050/pls/conv/psu.test_htp_arrays.p_create_contract',null);
    cntr := 0;
    pidm := 51855;
    htp.formhidden('pidm',pidm);
    FOR I in 1..5 LOOP
      cntr := cntr + 1;
      v_seq_no(cntr) := cntr;
      htp.formhidden('a_seq_no',v_seq_no(cntr));
    END LOOP;
    htp.formhidden('cntr',cntr);
    htp.formsubmit(null,'Enter Info');
    htp.formclose;
    htp.bodyclose;
    htp.htmlclose;
  END p_recommendations;

  PROCEDURE p_create_contract(pidm IN NUMBER DEFAULT NULL, a_seq_no IN seq_no_array DEFAULT NULL,
    cntr IN NUMBER DEFAULT NULL)

  IS
 
    -- This is the procedure that creates the contract

  BEGIN

    htp.htmlopen;
    htp.headopen;
      htp.title('testing arrays');
    htp.headclose;
    htp.bodyopen;
      htp.header(1,'Testing arrays part two');

        FOR RECS IN 1..cntr LOOP
          htp.print('Seq_no: '||a_seq_no(RECS));
        END LOOP;

    htp.bodyclose;
    htp.htmlclose;
  END p_create_contract;

END test_htp_arrays;
/
0
Laurianne
Asked:
Laurianne
1 Solution
 
IzabellaKCommented:
Try owa_util.ident_arr (not varrays)

Example :  

CREATE OR REPLACE PACKAGE software_release IS
PROCEDURE list;
PROCEDURE display_list (
--p_sw in varchar2,
player1 in owa_util.ident_arr,
player2 in owa_util.ident_arr,
player3 in owa_util.ident_arr);

END software_release;
/

CREATE OR REPLACE PACKAGE BODY software_release IS
procedure list

is

BEGIN

htp.htmlOpen;
htp.print('This is the list');
htp.bodyOpen;
htp.formOpen(owa_util.get_owa_service_path || 'software_release.display_list');
--htp.print('<input type="text" name="p_sw" size="32" maxlength="32">');
htp.formHidden('player1','Dummy');
htp.formSelectOpen('player1','Pick players for TEAM#1:',5,'MULTIPLE');
htp.formSelectOption('Messier');
htp.formSelectOption('Howe');
htp.formSelectOption('Gretzky');
htp.formSelectClose;
htp.formHidden('player2','Dummy');
htp.formSelectOpen('player2','Pick players for TEAM#2:',5,'MULTIPLE');
htp.formSelectOption('Long');
htp.formSelectOption('Stokes');
htp.formSelectClose;
htp.formHidden('player3','Dummy');
htp.formSelectOpen('player3','Pick players for TEAM#3:',5,'MULTIPLE');
htp.formSelectOption('Rice');
htp.formSelectOption('Young');
htp.formSelectOption('Phillips');
htp.formSelectClose;
htp.formSubmit(NULL,'submit list');
htp.bodyClose;
htp.htmlClose;
END;

procedure display_list (
--p_sw in varchar2 default null,
player1 in owa_util.ident_arr,
player2 in owa_util.ident_arr,
player3 in owa_util.ident_arr

)
is

player1_counter number:=2;
player2_counter number:=2;
player3_counter number:=2;
max_player1 number := player1.count;
max_player2 number := player2.count;
max_player3 number := player3.count;
BEGIN
htp.htmlOpen;
htp.print('TEAM #1 IS: ');
WHILE player1_counter < max_player1 + 1 LOOP
htp.br;
htp.print(player1(player1_counter));
player1_counter:=player1_counter+1;
end loop;
htp.para;
htp.print('TEAM #2 IS: ');
WHILE player2_counter < max_player2 + 1 LOOP
htp.br;
htp.print(player2(player2_counter));
player2_counter:=player2_counter+1;
end loop;
htp.para;
htp.print('TEAM #3 IS: ');
WHILE player3_counter < max_player3 + 1 LOOP
htp.br;
htp.print(player3(player3_counter));
player3_counter:=player3_counter+1;
end loop;
htp.htmlClose;
END;
END software_release;
0
 
LaurianneAuthor Commented:
Thanks!  I'll give that a shot.  (in the meantime I've flattened out the array to just variables (just to keep going on the job ) until I had a better solution and writing around those variables is a real pain - so now I can try going back to the array structure which is a lot better)  I tried using owa awhile ago and couldn't remember much of what I did back then...  I haven't been programming in plsql for more than a couple years and spent many years using the old languages which most are now defunct.  Now we've changed our database and the new technologies are arriving.  
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now