Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> PL/SQL Cursor with embedded Select on same view
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
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