DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: temporary tables

  1. #1
    Join Date
    Jun 2003
    Posts
    47

    Question temporary tables

    Hi everybody,

    I have a sp in T-sql which creates a temporary table and fills that with the resultset of a select statement.Then uses the temp table as a condition in another select statement :
    ... where x in (select * from temp);

    How can I do this in PL/SQL?
    I was thinking of table datatypes but I don't know how to get the content of the table datatype variable and do this
    where x in (select * from temp)

    Thank you
    edli

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    SQL Server is rather prone to that kind of workaround -- you don't have to do it in Oracle.

    If you populate a temp table in SQL server then select from it, just use an in-line join in Oracle.

    For example if you would populate a temporary table with the result of "select * from my_table_3 t3, my_table_4 t4 where t4.id=t3.id" then join to other tables, just do ...

    select *
    from my_table_1 t1,
    my_table2 t2,
    (select * from my_table_3 t3,
    my_table_4 t4 where t4.id=t3.id) t5
    where t1.id=t2.id and t2.id=t5.id
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width