Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Make use of the built-in functions for Tables

Re: Make use of the built-in functions for Tables

From: <dennis.pong_at_gmail.com>
Date: 18 Dec 2006 16:58:59 -0800
Message-ID: <1166489939.441769.36480@j72g2000cwa.googlegroups.com>


based on original ordering of the table. I was given the table without being told of the id as well. So I'd believe it's individual_id, a column in the table. But yes, there might be multiple individual_ids representing the minimum records and maximum records.

But that's not the point. My point is whether I could make use of the .first and .last properties of the cursor. If so, what'd be the proper way to set it up, if I haven't already.

Thanks,
-DP

DA Morgan wrote:
> dennis.pong_at_gmail.com wrote:
> > Hi,
> >
> > I'm not sure if I could do the following at all. I want to loop thru'
> > the table of records to check if
> > 1) it's the first record, then do something
> > 2) it's the last record, then do something
> >
> > CREATE OR REPLACE
> > PROCEDURE AS
> > first_entry_row new_scored_alm_leads_20061218%ROWTYPE := NULL;
> > last_entry_row new_scored_alm_leads_20061218%ROWTYPE := NULL;
> >
> >
> > CURSOR c3 IS
> > SELECT * FROM new_scored_alm_leads_20061218;
> >
> > BEGIN
> > FETCH C3.FIRST INTO first_entry_row
> > FETCH C3.LAST INTO last_entry_row
> > LOOP
> >
> > IF first_entry_row THEN
> > IF...
> >
> > ELSE N := N - 1 ;
> > END IF;
> >
> >
> >
> > ELSIF last_entry_row.Last THEN
> >
> > ...
> > END IF;
> >
> > END LOOP;
> > END;
> > I ended up getting a bunch of error messages like the following.
> > PLS-00225: subprogram or cursor 'C3' reference is out of scope
> >
> > (THis program has been simplified dramatically to illustrate the
> > problem)
> >
> > Could someone tell me how to go around this problem?
> >

>

> First entry?
> Last entry?
> Based on what?
> Rows don't come with first and last unless you have a column holding
> that information.
>

> Where did the above syntax come from?
> --
> Daniel A. Morgan
> University of Washington
> damorgan_at_x.washington.edu
> (replace x with u to respond)
> Puget Sound Oracle Users Group
> www.psoug.org
Received on Mon Dec 18 2006 - 18:58:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US