Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Using a Correlated subquery in a Cursor

Status
Not open for further replies.

Barbaro

Programmer
Jan 23, 2002
9
CL
Anybody knows why i cant compile a Procedure in pl/sql where i have a cursor like this:
cursor ajm is
select m.name,(select dt.dept from depttable dt where dt.name=m.name) from master m;
 
Try:

cursor ajm is
select m.name, dt.dept
from from master m, depttable dt
where dt.name=m.name; DaPi - no silver bullet
 
Why don't you compile

cursor ajm is
select m.name, dt.dept
from depttable dt,master m
where dt.name=m.name;

??? Regards, Dima
 
OK Dima, you win - I didn't delete the second from! DaPi - no silver bullet
 
DaPi: I suppose that everyone here is sure that I just copy your answers (sometimes changing the order of words or making intentional typos to hide this). Swear I don't :) Regards, Dima
 
Thanks DaPi, your answer gives a different resultset that mine does. My query returns nulls if the name is not found. Your query would return the names that exist in both tables.

cursor ajm is
select m.name, dt.dept
from master m, depttable dt
where dt.name(+)=m.name;

With this modification i found it would work fine.
Thanks Anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top