Re: How do get around Sequence number in Group By Query?

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/05/30
Message-ID: <31adb112.2510309_at_dcsun4>#1/1


On 28 May 1996 22:46:04 -0400, badri_at_cc.gatech.edu (badri) wrote:

>Hi:
>
> Here is what I want to happen:
>
> I have a query of the following form:
>
> Insert into table1 (select sequence1.nextval, sum(col1), col2
> from table2
> group by ...)
>

In 7.1 and above the following works:

insert into table1
select sequence1.nextval, sum_col1, col2 from ( select sum(col1) sum_col, col2

         from table2
        group by col2 )

/

> Obviously ORACLE gives me the error that a sequence number is
>not allowed in that group by query. How do I get by it?
>
> I can think of a before insert trigger that would change
>the new value of the column in table 1 to sequence_number.nextval.
>Is there a more elegant way?
>
>thanks a lot,
>
>-Badri
Received on Thu May 30 1996 - 00:00:00 CEST

Original text of this message