Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Union select over temp table

Tobias ArnholdNov 4 2010 — edited Nov 4 2010
Hi,

I have a question about the best solution in selecting data from two tables and one of it is a temp table.
If ID is found on both tables, only the temp_table row should be selected. My solution looks like:
ORIG_TABLE
PK_ID
Data1
Data2
status_cd

TEMP_TABLE
PK_ID
Data1
Data2
status_cd

select data1, data2, status_cd from ORIG_TABLE
  where pk_id not in (select pk_id from temp_table)
union
select data1, data2, status_cd from TEMP_TABLE
I wonder if there is an easier way in selecting data like that.

Thanks ahead,

Tobias
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 2 2010
Added on Nov 4 2010
4 comments
161 views