Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL help
Maxim Demenko wrote:
> Unfortunately, will lead to an error...
> ;-)
>
> Best regards
>
> Maxim
Au contraire.
CREATE TABLE t1 (
pname VARCHAR2(10),
cases NUMBER(3));
INSERT INTO t1 VALUES ('Smith',2); INSERT INTO t1 VALUES ('John',3); INSERT INTO t1 VALUES ('Mary',2); INSERT INTO t1 VALUES ('Kate',1);
CREATE TABLE t2 AS
SELECT pname FROM t1
WHERE 1=2;
SELECT * FROM t2;
BEGIN
INSERT INTO t2
WITH rn AS (
SELECT rownum rn FROM dual CONNECT BY LEVEL <= (SELECT MAX(cases) FROM t1))SELECT pname
SELECT * FROM t2;
-- Daniel Morgan University of Washington Puget Sound Oracle Users GroupReceived on Thu Sep 28 2006 - 13:57:44 CDT
![]() |
![]() |