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 -> PL/SQL Cursor problem

PL/SQL Cursor problem

From: Richard Elliott <Richard.A.Elliott_at_wgp.twc.com>
Date: Tue, 29 Sep 1998 20:40:11 GMT
Message-ID: <36114725.39DC@wgp.twc.com>


I have a fairly complicated SQL statement that was formaly a defined View. I am trying to use the underlying select stmt, with host variables, as the select for a cursor. The SQL works fine as stand alone SQL and as the select for a view. However if I use it as the query for a cursor I get an error on the line that is the first line of a sub-select used for the "from" stmt (not a "where" stmt). The SQL has several sub-selects and several unions. It is the only example of a sub-select being used for a "from" stmt I can find. Is there some limit or rule about this type of subselect being used in a cursor ? I have attached the first several lines of the stmt. The entire stmt is about 60 lines long and has 6 unions. The !! is the line I get the error on..

PLS-00103: Encountered the symbol "(" when expecting one of the following: <an identifier> <a double-quoted delimited-identifier>

     cursor summary_cursor
     is
    SELECT Prod_Date, SUM(MCF_In) mcfin, SUM(Pack_Change_MCF) packmcf,
     SUM(MCF_Out) mcfout, SUM(DT_In) dtin, SUM(Pack_Change_DT) packdt
     SUM(DT_Out) dtout

 !! FROM (
    SELECT m.Production_Date Prod_Date,     SUM(DECODE(s.Station_Flow,'INTO SYSTEM', m.MCF_at_1473,0)) MCF_In,     0 Pack_Change_MCF,
    SUM(DECODE(s.Station_Flow,'OUT OF SYSTEM', m.MCF_at_1473,0)) MCF     SUM(DECODE(s.Station_Flow,'INTO SYSTEM', m.Dekatherm,0)) DT_In     0 Pack_Change_DT,
    SUM(DECODE(s.Station_Flow,'OUT OF SYSTEM', m.Dekatherm,0)) DT_Ou ******* cliped *****

This one has me baffeled (not that hard to do obviously). Any help would be much appreciated. Thanks in advance.. Reply to E:Mail also please. I sometimes can't get back to the newgroup before the replys are rolled off. Received on Tue Sep 29 1998 - 15:40:11 CDT

Original text of this message

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