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

Home -> Community -> Usenet -> c.d.o.server -> Re: Wanted to know some info about top 1 query in cursors

Re: Wanted to know some info about top 1 query in cursors

From: Martin Haltmayer <Martin.Haltmayer_at_0800-einwahl.de>
Date: Thu, 23 Dec 1999 18:30:12 +0200
Message-ID: <38624E14.3A8FC669@0800-einwahl.de>


Hi sudhakar,

this is two plain syntax errors:

group by does not have asc or desc (these are options for ordering)

order by in a union may only appear at the end of the statement.

Try your statements first outside of a cursor environment. It is much easier to debug.

Martin

sudhakar wrote:
>
> Hi all,
> I want to know what are the limitations of cursors in terms
> of sql
> I am getting error when for the following procedures......
> 1.
> create or replace procedure test is
> Cursor Cur_SecRes is
> select secresdesc,secrescode from
> (SELECT SECRESDESC,secrescode FROM SECONDARYRES group BY
> secrescode asc, SECRESDESC desc)
> WHERE ROWNUM=1;
> Begin
> for x in Cur_SecRes
> loop
> dbms_output.put_line(x.secrescode | | ' ,' | |
> x.secresdesc);
> end loop;
> End;
> The above procedure is opens the top q query, which is
> required for imporving performance. The query is running in
> Sql Plus, but if I include the query in PL sql block it is
> giving error.
> Is there any way out for running the above query, If any
> body knows then please let me know at
> sudhakar_kb_at_hotmail.com
>
> Similarly the second procedure is giving error......
> 2.
> create or replace procedure test is
> Cursor Cur_SecRes is
> SELECT SECRESDESC,secrescode FROM SECONDARYRES order BY
> SECRESDESC desc,secrescode
> union all
> SELECT priRESDESC,prirescode FROM priONDARYRES order BY
> SECRESDESC desc,secrescode;
> begin
> for x in Cur_SecRes
> loop
> dbms_output.put_line(x.secrescode | | ' ,' | |
> x.secresdesc);
> end loop;
> end;
>
> overall I need to know the limitations of cursor or pl sql
> block,
>
> Thanks in advance.....
>
> Regards,
> sudhakar
>
> * Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
Received on Thu Dec 23 1999 - 10:30:12 CST

Original text of this message

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