• Subject: Re: HOW TO USE CURSORS
  • From: "Anu Radha" <anu133@xxxxxxxxxxx>
  • Date: Wed, 10 Mar 1999 06:33:12 PST

Deepak,
     declare the cursor with SCROLL or DYNAMIC SCROLL option as 
following
     1.  DECLARE EMPLOYEECURSOR SCROLL CURSOR FOR......
     2.  OPEN EMPLOYEECURSOR
     3.  FETCH XXXXX FROM EMPLOYEECURSOR
         INTO :EMPNO, :EMPNAM, :EMPSAL

     where XXXX can be any one of the following:
     
      NEXT  -      Positions Cursor on the next row after the current           
         
row.
      PRIOR -      On the row before the current row.
      FIRST -      On the first row.
      LAST  -      On the last row.
      Before -     Before the first row.
      After -      After the last row.
      Current -    On the current row (no change in position).
      Relative n - Positions to nth row before/after current depending  
on n is +ve or -ve.

     4. After fetching, you can update or delete the record.
       UPDATE EMPLOYEE
       SET SALARY = :NEWSAL 
       WHERE CURRENT OF EMPLOYEECURSOR

     
    You can also fetch or insert multiple rows at a time.
        FETCH NEXT 
        FROM EMPLOYEECURSOR
        FOR :COUNT ROWS
        INTO :EMPDS

        INSERT INTO EMPLOYEE
        :COUNT ROWS
        VALUES( :EMPDS) 
          
    where EMPDS is a multiple occurance data structure which has empno, 
empname, empsal etc as the subfields. :COUNT is the number of rows you 
want to fetch/insert.  
       
        I hope I didn't confuse you.


-ANU
          

________________
Get Your Private, Free Email at http://www.hotmail.com
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.