Dead Programmer
Dead Programmer

Reputation: 12575

oracle sql writing merge statement inside a select

Guys is it possible to write a merge statement inside a select like below for correlated subqueries

my requirement is that i have pass to each date from top select statement and for the each date select statement inside using clause should check any data exists for that date and then do insert or update

select date from A a where exists (

merge in to B b 
using (

)
..
..

)

Upvotes: 0

Views: 727

Answers (1)

Tony Andrews
Tony Andrews

Reputation: 132580

Surely you just want to use the SELECT inside the using clause?

merge into B b 
using (
select ... where datecol = (select datecol from A a where ...)
)
..
..

)

Upvotes: 2

Related Questions