Solved

Oracle plsql web toolkit and passing array values problems.

Posted on 2004-04-15
2
8,536 Views
Last Modified: 2013-12-01
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
Comment
Question by:Laurianne
2 Comments
 
LVL 1

Accepted Solution

by:
IzabellaK earned 500 total points
ID: 10862922
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
 

Author Comment

by:Laurianne
ID: 10863267
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now