Re: Cannot run Top-N query in PL/SQL

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Wed, 18 Oct 2000 10:59:49 +0100
Message-ID: <971863921.587.2.nnrp-10.9e984b29_at_news.demon.co.uk>


This is just the usual problem of PL/SQL lagging a little way behind SQL - Oracle 9 promises to make this problem a thing of the past.

I guess you already figured out that the work around is to open a REF CURSOR for your execute immediate.

--

Jonathan Lewis
Yet another Oracle-related web site:  http://www.jlcomp.demon.co.uk

Ling wrote in message ...

>Hi all,
>I am using 8i 8.1.6 on NT. I want to execute a Top-N query in a PL/SQL
>package. For example
> Select colA, colB, colC, colD into a, b, c, d
> from ( select colA, colB, colC, colD from tableA order by ID )
> where rownum = 1;
>
>If I just include the SQL in a procedure, the compiler keep telling me the
>last bracket is not supposed to be there.
>If I put the SQL in a varchar2 and use execute immediate statement, it
>passes the compiler and the SQL works.
>
>Any idea?
>
>Ling
>
>
>
Received on Wed Oct 18 2000 - 11:59:49 CEST

Original text of this message