Solved

oracle plsql web toolkit and arrays - having trouble passing the values.

Posted on 2004-04-14
5
475 Views
Last Modified: 2013-12-12
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
  • 3
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
Helena Marková earned 500 total points
ID: 10840028
I would advice you to try both procedures without HTP package.

In this line:
    htp.formopen('https://aragorn.plymouth.edu:8050/pls/conv/psu.test_htp_arrays.p_create_contract',null);

I cannot see parameters passed to the procedure p_create_contract.

I hope this will be a little help for you.
0
 

Author Comment

by:Laurianne
ID: 10841645
Hello and thanks for your advice.  What you mentioned was done and does help to some point but the real issue I'm having is with that htp layer....  when the forms come on board, the procedure appear lost as to what to do.  For instance

     from form 1:
        htp.formtext('a_variable',a_variable_value(loop_int),9,9,null);

when the submit happens the a_variable passes onto the next procedure and then just dies.  At the address line, I'm seeing the values of the array with variables of the same name repeated with each value.  I guess, how do I get those values down into the procedure and usable? I guess I'm having trouble articulating the situation due to the fact that I'm new to these and not exactly sure what is going on behind the scenes except for what I'm "seeing" via debugging.   Thanks!  
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 10857471
This is description of HTP package procedure formText:
procedure formText(cname       in varchar2,
                   csize       in varchar2 DEFAULT NULL,
                   cmaxlength  in varchar2 DEFAULT NULL,
                   cvalue      in varchar2 DEFAULT NULL,
                   cattributes in varchar2 DEFAULT NULL);

Here we can see that cmaxlength and cvalueare are varchar2, so you can try:

htp.formtext('a_variable',a_variable_value(loop_int),'9','9',null);
0
 

Author Comment

by:Laurianne
ID: 10858886
   PROCEDURE p_create_contract(pidm IN NUMBER DEFAULT NULL, id IN VARCHAR2 DEFAULT NULL,
    v_max_cr_load IN NUMBER DEFAULT NULL, v_recom_comments IN LONG DEFAULT NULL,
    v_pass_assist IN VARCHAR2 DEFAULT NULL, v_col_wr_ctr IN VARCHAR2 DEFAULT NULL,
    v_math_activity_ctr IN VARCHAR2 DEFAULT NULL, v_major IN VARCHAR2 DEFAULT NULL,
    a_repeat_subj_recom IN SUBJ_REC_ARRAY DEFAULT NULL,
    a_repeat_numb_recom IN NUMB_REC_ARRAY DEFAULT NULL,
    firstname IN VARCHAR2 DEFAULT NULL, mi IN VARCHAR2 DEFAULT NULL, lastname IN VARCHAR2 DEFAULT NULL)

  IS

/* There is a lot of stuff between above and below... declarations etc....   looping structures have been worked in and this works fine if we're just using pl/sql but once this is implemented through the form/htp routine/functions things muddy up and don't work  */

          FOR N in 1 .. 1 LOOP
             IF a_repeat_subj_recom(N) IS NOT NULL THEN
                htp.print(a_repeat_subj_recom(N)||a_repeat_numb_recom(N));
                htp.br;
             END IF;
            END LOOP;
            htp.para;

NOTE:
This a sample of one thing tried but the procedure refuses to reconize the values in this array.  I flattened out the array and it works [I'm stuck doing it that way for now - project deadline coming up - and sorely miss the beauty and efficiency of an array] and that is not exactly the correct way to do this me thinks....  I see the values passing from the recommendations procedure to the contract procedure in the address line.  The contract procedure appears at a loss as to how to handle those values...  It doesn't make a lot of sense to me why those values can't be handled...  Ideas are certainly welcomed!  
0
 
LVL 22

Expert Comment

by:Helena Marková
ID: 10866262
It seems that it will be better to use variables instead of arrays.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

911 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

22 Experts available now in Live!

Get 1:1 Help Now