Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help! Question on PL/SQL
A copy of this was sent to "Dana Jian" <djian_at_trasa.com>
(if that email address didn't require changing)
On Thu, 20 Jan 2000 10:46:15 -0500, you wrote:
>Hi,
>
>I'm converting one procedure from SQL server to Oracle procedure.
>
>Here's the simplified statements in the SQL proc,
>
>SELECT ... INTO #temp1 FROM....WHERE..
>
>SELECT ... INTO #temp2 FROM... WHERE
>
>SELECT ... FROM #temp1, #temp2 , .... WHERE ...
>
>How to do this in Oracle PL/SQL?
>
Oracle likes complex queries -- don't be afraid to do in one query what you would not dream of doing in SQL Server.
Quickest way to do the above is:
select ....
from ( select .... from ... where .... ),
( select .... from .... where .... ) where .....
don't write the results into a temp table and then join them -- just join them right away. If you need to know how to return a result set from a stored procedure see http://osi.oracle.com/~tkyte/ResultSets/index.html
>Any comments/help will be highly appreciated!!
>
>Dana
>djian_at_trasa.com
>
>
>
--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jan 20 2000 - 10:39:46 CST