oracle - SQL CASE expression returning multiple rows -
i working cursor has case expression in 1 of where-clauses, so:
select tbl.id table1 tbl tbl.id = case when [some condition] [a single id number] else ( select tbl2.id table2 tbl2 [some other condition] ) end
this works until sub-select returns multiple rows. if happens ora-01427 exception thrown. i've tried remedy using in or statements, looks me case expression unable output sets of multiple values.
if possible, how 1 create clause one, wherein sub-select potentially return multiple rows?
how can compare tbl.id = [multiple rows]?
you need use "exists" or " in " syntax. example:
select tbl.id table1 tbl ( [some condition] , tbl.id = [a single id number]) or ( not [some condition] , tbl.id in ( select tbl2.id table2 tbl2 [some other condition])
Comments
Post a Comment