Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Similar to alias, but to be reusable in all clauses of SQL: SELECT
qazmlp1209_at_rediffmail.com wrote:
> DA Morgan wrote:
>> Use a WITH query.
The SQL statement you wrote makes 'mycolumn' the equivalent of a table: Not a column. Look at this example posted by Michel Cadot a few months back:
INSERT INTO t2
WITH rn AS (
SELECT rownum rn
FROM dual
CONNECT BY LEVEL <= (SELECT MAX(cases) FROM t1))
SELECT pname
FROM t1, rn
WHERE rn <= cases
ORDER BY pname;
Not "WITH rn" and later "FROM t1, rn"
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Thu Jan 18 2007 - 10:14:45 CST
![]() |
![]() |