Re: Is there a way to use arrays in Form 4.5?

From: <Herman_Mantzke_at_dci-ltd.com>
Date: Mon, 01 Mar 1999 19:55:54 GMT
Message-ID: <7berc5$2ea$1_at_nnrp1.dejanews.com>


Damon, To do file manipulation, check the UTIL_FILE package. To do array processing, here is an example package:

CREATE OR REPLACE PACKAGE plsql_array
IS

   /* This version can only be used in PL/SQL Release 2.3 and beyond. */    /* The cursor against the database table. */    CURSOR patient_cur IS

     SELECT pat_id, pat_last_name, pat_first_name
     FROM patient
     WHERE rownum < 10;

   /* The PL/SQL table TYPE based on the cursor. */    TYPE patient_tabtype IS

      TABLE OF patient_cur%ROWTYPE
      INDEX BY BINARY_INTEGER;

PROCEDURE read_in_array;

END plsql_array;
/

CREATE OR REPLACE PACKAGE BODY plsql_array IS

PROCEDURE display_array (patient_in IN patient_tabtype, num_of_recs IN INTEGER) IS disp_row INTEGER := 0; BEGIN /* The display FOR loop */ FOR disp_row IN 1..num_of_recs LOOP /* Display the message, including the row

number */  DBMS_OUTPUT.PUT_LINE ('Value in ROW '||TO_CHAR(disp_row)||': '|| 
TO_CHAR(patient_in(disp_row).pat_id)||': '|| 
patient_in(disp_row).pat_last_name||': '|| 
patient_in(disp_row).pat_first_name);  END LOOP; END;

PROCEDURE read_in_array
IS

   patient_table patient_tabtype;
   next_row INTEGER := 0;
BEGIN
   /* The cursor FOR loop */
   FOR patient_rec IN patient_cur
   LOOP

      /* Get last row used and add one. */
          next_row := next_row + 1;
      /* Set the row values for ID and dates. */
      patient_table(next_row).pat_id := patient_rec.pat_id;
      patient_table(next_row).pat_last_name := patient_rec.pat_last_name;
      patient_table(next_row).pat_first_name := patient_rec.pat_first_name;
   END LOOP;    display_array (patient_table, next_row);

END; END plsql_array;
/

Herman Mantzke, DCI-OKC

In article <36D56C08.7FDA8527_at_singnet.com.sg>,   Damon Chong <damon_at_singnet.com.sg> wrote:
> Hi, sorry i'm very new to Oracle tools. I need to open a file, read the
> content which is in comma delimited values and store the values in
> variables. I using purely Forms 4.5 to do the above. I'm unable to find
> a way to make use of arrays to store the values in the help file.
> Currently, i'm using many declared variables to store the values which
> is very cumbersome. I would really appreciate if anyone have better
> suggestions.
>
> Thank you.
>
>

[Quoted] -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Mon Mar 01 1999 - 20:55:54 CET

Original text of this message