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 -> Sub-query in Oracle cursor

Sub-query in Oracle cursor

From: Ola <ola_aminu_at_hotmail.com>
Date: 9 Aug 2002 04:01:47 -0700
Message-ID: <176ea8c0.0208090301.3633d1ba@posting.google.com>


I'm trying to create a cursor with a subquery and this seems to upset Oracle...
The following snippet shows what I'm trying to do.

CREATE OR REPLACE PROCEDURE PRC_MyTest AS

CURSOR MyCursor IS
SELECT
    (SELECT COUNT(*) FROM Table1) MyCount ,     Column1,
    Column2
FROM Table1;

BEGIN
    return;
END; The procedure compiles when I take out the line "(SELECT COUNT(*) FROM MyTable) MyCount ,"

Executing the SQL below, in isolation from the procedure also works fine from the command line

SELECT (SELECT COUNT(*) FROM Table1) MyCount,

    Column1,
    Column2
FROM Table1;

Any ideas of what the problem is and any solutions will save my sanity and hence will be most appreciated.

Thanks Received on Fri Aug 09 2002 - 06:01:47 CDT

Original text of this message

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