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 -> PL/SQL Cursor with embedded Select on same view

PL/SQL Cursor with embedded Select on same view

From: JudyD <jdouvas_at_healthetech.com>
Date: 28 Jan 2003 09:58:30 -0800
Message-ID: <90f4d8fa.0301280958.72f208f@posting.google.com>


Within SQL Plus, I executed a select statement with an embedded select on the same view as the parent select statement. It worked fine. Pulling that select statement into PL/SQL under a cursor definition statement failed with an error message that the embedded table or view didn't exist. Are embedded selects on the same structure as the parent disallowed on PL/SQL? Is there a work-around? HELP Please!

CURSOR my_cur IS
SELECT a.user_id,

	   a.log_date, 
	   a.cola,
	   a.colb,
	   a.colc, 
	   a.cold, 
	   sum(a.amount) amount 

FROM my_view_mv a
WHERE a.user_id = p_USER_ID
  and a.log_date between p_LOG_DATE1 and p_LOG_DATE2
  and a.cole=( 
		SELECT max(a2.cole) 
		FROM my_view_mv a2 
		WHERE a2.log_date=a.log_date 
		and a2.cola=a.cola
		and a2.user_id=a.user_id 
		and a2.colb=a.colb
		and a2.food_id=a.food_id) 
GROUP BY a.user_id, 
	 a.log_date, 
	 a.cola,
	 a.colb,
	 a.colc,
	 a.cold;
Received on Tue Jan 28 2003 - 11:58:30 CST

Original text of this message

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