Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: insert into ... select *
There are a number of ways
you could do
insert into table_arch(create_date,col_list) select sysdate,col_list from table_runtime where ....
You could create a before insert trigger along the lines of
create or replace trigger trg_arch
before insert on table_runtime
for each row
begin
select sysdate into :new.create_date from dual;
end;
/
or you could set the default for the column to the value sysdate.
I suspect there might be a couple of other ways as well :(
-- Niall Litchfield Oracle DBA Audit Commission UK "Rainer Nonk" <gora_at_gmx.net> wrote in message news:3EAE1A1F.E81E529E_at_gmx.net...Received on Tue Apr 29 2003 - 03:09:47 CDT
> Hi,
>
> I would like to extend the following statement
> insert into table_arch select * from table_runtime where order_number =
> 'abc';
>
> table_arch got a new field (a date field, with a creation timestamp). So
> it has one field more than table_runtime. The problem is: i don't have
> any idea how to fill this additional field within one statement. Could
> you give me a hint how the new statement should look like ?
>
> (And: i know how to get the current date: select sysdate from dual ;-)
>
> thank you,
> Rainer
>