|
|
|
Re: Want to refer the column [message #258130 is a reply to message #258070] |
Fri, 10 August 2007 06:19 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I'm sorry, but - what is not happening?
Establishing a data link between queries is trivial.
As of my second suggestion, I created a sample report based on Scott's schema - I used a column from the first query in WHERE clause of another query. Report compiles and executes. So, it IS possible.
REM query 1
select deptno q1_deptno, dname, loc
from dept
where loc = 'CHICAGO'
REM query 2
select deptno, ename, job, sal
from emp
where deptno = :q1_deptno
Now, could you spend some more time and effort to explain what you, actually, want to accomplish? Total of two sentences in two posts isn't very descriptive.
|
|
|
|
Re: Want to refer the column [message #258341 is a reply to message #258330] |
Sat, 11 August 2007 03:24 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I am not angry. It is the biometeorological situation that drives me crazy. Sorry.
If you can not link those queries, I'm afraid you can not make second query fetch data for every record returned in the first query. As you have seen, using a column as a parameter is possible, but it would make query_2 to return records which are in relation ONLY to the last query_1 returned record.
For example, if query_1 returned DEPTNOs 10 and 20, query_2 would return employees who work in DEPTNO = 20.
The next suggestion might be joining two queries into a single one (referring to my last example):REM query_3 = query_1 + query_2
select e.deptno, e.ename, e.job, e.sal
from emp e, dept d
where e.deptno = d.deptno
and d.loc = 'CHICAGO'
Currently, I can't suggest any other option.
|
|
|
|
Re: Want to refer the column [message #259284 is a reply to message #258345] |
Tue, 14 August 2007 23:09 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
ab_trivedi
Messages: 460 Registered: August 2006 Location: Pune, India
|
Senior Member |
|
|
Ref cursor is nothing but parameterized cursor. If you the concept of cursor then it will not take much time for you to understand the Ref cursor. You want to pass the parameter in the query itself.
Ashu
|
|
|