it is posible to use math operations between together

by Jozef Kostelansky
(Slovakia)

I mean, its way to use something like this:


SELECT (1+1) AS S1,
(2 + S1) AS S2,
(2 + S2) AS S3
FROM DUAL

Comments for it is posible to use math operations between together

Average Rating starstarstarstarstar

Click here to add your own comments

Mar 02, 2015
Rating
starstarstarstarstar
Use subqueries
by: Anonymous

You can do this quite easily if use subqueries.

WITH q_one (s1) AS
( SELECT 1+1 FROM dual)
,q_two (s2) AS
( SELECT s1+2 FROM q_one )
SELECT (2 + S2) AS S3
FROM q_two

The original query doesn't work because S1 and S2 need to be defined they can be accessed in the query.

Refer to the sction on subqueries in the Oracle SQL Lanaguage Reference http://docs.oracle.com/database/121/SQLRF/statements_10002.htm#i2129904 .

Click here to add your own comments

Join in and write your own page! It's easy to do. How? Simply click here to return to Oracle Questions.