[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

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

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
  • 3
  • 2
1 Solution
 
Helena Markováprogrammer-analystCommented:
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
 
LaurianneAuthor Commented:
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
 
Helena Markováprogrammer-analystCommented:
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
 
LaurianneAuthor Commented:
   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
 
Helena Markováprogrammer-analystCommented:
It seems that it will be better to use variables instead of arrays.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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