Question On using CURSORS in PL/SQL with SQL*Forms3.0

From: Sudhakar Bhagavatula <sab3_at_Ra.MsState.Edu>
Date: 26 Jun 1993 19:37:04 GMT
Message-ID: <20i8h0$5ab_at_Tut.MsState.Edu>


The user enters a last name to query an article. I want to pull out all the author who have written the article. To do this i've written a Procedure using CURSORS.

procedure select_authors is

     pid_val number; /* This is the PID of the article */    BEGIN
       pid_val := to_number(:system.cursor_value); /* After the user enters the lastname to query for a particular article i`m

    reading the value of the PID which is in the same row as that of the LNAME     in the current block. ( I'm using a block which is a default block of the     WRITES table to read the LNAME entered by the user). */

      previous_field;

/* After reading in the PID value i go back to the LNAME field. */

     DECLARE
           CURSOR lname_cur IS
            SELECT WRITES.LNAME from WRITES
		where WRITES.PID = pid_val;      
           lastname WRITES.LNAME%TYPE;

/* lastname is a field in author block where i want to display all the authors

   of the article. This author block is a control block. */

     BEGIN  /* Begin of the CURSOR LOOP */
         OPEN lname_cur;
       LOOP
          FETCH lname_cur into :author.lastname;
          EXIT when lnamecur%NOTFOUND;
       ENDLOOP;
	CLOSE lname_cur;

    END; /* End of the CURSOR LOOP */
  END; /* End of the Procedure. */

The problem i have here is:
The select statement should pull out LNAME`s of three authors but only the last row (i.e., the LNAME of the last author out of the three author's is being displayed in the field lastname of the block author). Could Someone Please help me with this problem.

THANKS IN ADVANCE.
--Sudhakar.

Please reply to my e-mail address.
sudhakar_at_walt.cs.msstate.edu
or
sab3_at_ra.msstate.edu  

--

<< Sudhakar >> Received on Sat Jun 26 1993 - 21:37:04 CEST

Original text of this message