Solved

Oracle plsql web toolkit and passing array values problems.

Posted on 2004-04-15
2
8,559 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

734 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