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!

How to use a calculated column in the same query

551174Jun 5 2009 — edited Jun 5 2009
Hi All,

I need some help with using a calculated column in the same query.
For eq

I am joining a couple of tables and some of the select columns are calculated based on the columns of the tables and i want a new column in the same query to use this calculated feild in some other calcualtion.

something like this...

select (12+3) as Sum1, (12-3) as Sum2, (Sum1 + Sum2 ) as Sum3
from dual
or
select (12+3) as "Sum1", (12-3) as "Sum2", CASE WHEN ( "Sum1" / "Sum2" * 100 > 0 ) THEN 'Yes' ELSE 'No' END
from dual


Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 3 2009
Added on Jun 5 2009
6 comments
1,385 views