Looping Queries in Oracle using data from SQL Server
5 pts.
0
Q:
Looping Queries in Oracle using data from SQL Server
I have a table of entries from SQL server called PID. Each of this entry should follow the following
select * from HR.TABLES a START WITH a.SID = '0' CONNECT BY PRIOR a.parentid = a.sid'
Where I have '0' in the query above, should take all the values from PID.
Is there a easy way to write this? or should I loop through the query like
foreach ( value from arraylist)
{
select * from HR.TABLES a START WITH a.SID = 'value' CONNECT BY PRIOR a.parentid = a.sid'
}
IN short I need to do something like above and I am really tired thinkin about it for past 2 days. Please help .
THanks in advance
ASKED: Feb 28 2009  4:05 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
46795 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Are you looking for a self join?

SELECT a.*
FROM HR.TABLES a
JOIN HR.TABLES b ON a.parentid = b.sid
WHERE a.sid = 'value'
Last Answered: Mar 1 2009  8:29 AM GMT by Mrdenny   46795 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Carlosdl   29820 pts.  |   Mar 2 2009  8:36PM GMT

Are you doing this on Oracle or Sql Server ? what version ?

 
0