Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Returning the largest value from a cursor
Sean Byrne <byrne_sean_spamtrap_at_hotmail.com> wrote:
>Hi,
>
>Newbie question:
>
>I have the following cursor for which I wish to return only the largest
>unique_id at one stage of my PL-SQL.
>
>CURSOR LastActivityCursor (cin_fk_job INTEGER) is
> select o.unique_id
> FROM homs.t_objects o
> where o.Fk_Job = cin_fk_job
> and o.type = 'ACTIVITY'
> and o.status_id = 1;
>
>If I rewrite the cursor to do:
>select MAX(o.unique_id)...
>
>when I try and use c_rec1.unique_id later in the script it barfs with:
>ORA-06550: line 52, column 44:
>PLS-00302: component 'UNIQUE_ID' must be declared
>
>What am I doing wrong?
>
>Cheers,
>Sean
MAX is a Sqlplus not Pl/Sql function and, since I assume you are using some level of 8i of Oracle ( it would work in 9.2) , you can try using dynamic Sql... Received on Wed Oct 06 2004 - 13:43:20 CDT