PL/SQL (MOSC)

MOSC Banner

sql- reference value selected in main query in case statement

edited Dec 2, 2009 3:49AM in PL/SQL (MOSC) 5 commentsAnswered
Hi the query below returns an ora-00904 t.id invalid indetifier error

Is there any way IN 10g to reference the t.id (as selected in the main query )

in the case statement?

select t.id,

t.code,

case t.code

when 1 (select sum(amount_1) from

(select bal_1 amount_1 from tc tc1

where tc1.type = 'P'

and tc.tid= t.id

union

select bal_2 amount_1 from tc tc2

where tc2.type = 'Y'

and tc2.tid = t.id))

else 1000

end as mm

from t;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center