Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: insert into ... select *

Re: insert into ... select *

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Tue, 29 Apr 2003 09:09:47 +0100
Message-ID: <3eae334c$0$29710$ed9e5944@reading.news.pipex.net>


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...

> 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
>
Received on Tue Apr 29 2003 - 03:09:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US