Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8399509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:19:29+00:00 2026-06-09T21:19:29+00:00

When inserting values into TARGET_TABLE with below INSERT..SELECT statement, the column default for the

  • 0

When inserting values into TARGET_TABLE with below INSERT..SELECT statement, the column default for the column lastupdate seems to be prioritized over the value resulting from the SELECT statement.

Even though there is always a value for this column in the SOURCE_TABLE.

Example:

SOURCE_TABLE contains lastupdate = 16.08.12 15:41:44

After executing the statement, lastupdate in TARGET_TABLE gets set to SYSDATE, e.g. 16.08.12 15:49:14:

INSERT INTO TARGET_TABLE (A, B, C, D, LASTUPDATE, F)
        SELECT A, B, C, D, LASTUPDATE, F
            FROM SOURCE_TABLE
            WHERE B = 'some_value';


CREATE TABLE TARGET_TABLE
(
ID NUMBER NOT NULL,
A VARCHAR2(255 CHAR) NOT NULL,
B VARCHAR2(255 CHAR) NOT NULL,
C CLOB NOT NULL,
D VARCHAR2(255 CHAR),
LASTUPDATE DATE DEFAULT SYSDATE,
E DATE DEFAULT SYSDATE
)

Oracle version: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production

I would like the value to be copied from SOURCE_TABLE to TARGET_TABLE and not to be set to SYSDATE.

What am I missing here? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:19:30+00:00Added an answer on June 9, 2026 at 9:19 pm

    Can you copy and paste from a SQL*Plus session showing this behavior? It doesn’t reproduce on my 11.2 database and it’s not something that I’ve ever personally seen happen.

    SQL> CREATE TABLE TARGET_TABLE
      2  (
      3  ID NUMBER NOT NULL,
      4  A VARCHAR2(255 CHAR) NOT NULL,
      5  B VARCHAR2(255 CHAR) NOT NULL,
      6  C CLOB NOT NULL,
      7  D VARCHAR2(255 CHAR),
      8  LASTUPDATE DATE DEFAULT SYSDATE,
      9  E DATE DEFAULT SYSDATE
     10  );
    
    Table created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  CREATE TABLE SOURCE_TABLE
      2  (
      3  ID NUMBER NOT NULL,
      4  A VARCHAR2(255 CHAR) NOT NULL,
      5  B VARCHAR2(255 CHAR) NOT NULL,
      6  C CLOB NOT NULL,
      7  D VARCHAR2(255 CHAR),
      8  LASTUPDATE DATE DEFAULT SYSDATE,
      9  E DATE DEFAULT SYSDATE
     10* )
    SQL> /
    
    Table created.
    

    I had to change your INSERT into SOURCE_TABLE to specify the column E rather than F since the CREATE TABLE statement only had a column E.

    SQL> insert into source_table( id, a, b, c,d, lastupdate, e )
      2    values( 1, 'A', 'some_value', empty_clob(), 'D', date '2012-01-01', sysdate );
    
    1 row created.
    

    I also had to change your INSERT into TARGET_TABLE to add the ID column since that has a NOT NULL constraint. I’m assuming that in your actual example this is probably getting populated by a trigger on TARGET_TABLE that is selecting the data from a sequence. Is it possible that this trigger (or some other trigger) is setting the LASTUPDATE value as well?

    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO TARGET_TABLE (ID, A, B, C, D, LASTUPDATE, E)
      2          SELECT ID, A, B, C, D, LASTUPDATE, E
      3              FROM SOURCE_TABLE
      4*             WHERE B = 'some_value'
    SQL> /
    
    1 row created.
    
    SQL> select id, lastupdate from target_table;
    
            ID LASTUPDAT
    ---------- ---------
             1 01-JAN-12
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am inserting values into a table and below is my code protected void
Hi I'm inserting Latitude, Longitude values into the database. INSERT INTO `Tracks` (`Latitude`, `Longitude`,
I get some strange behavior when inserting values into a map: I always insert
Using http://www.cppreference.com/wiki/stl/deque/insert as a reference, I was inserting values into a deque at certain
We are inserting values into a SQL Server 2005 database column of type NUMERIC(19,5)
i am inserting values like ' $5.99 ' (or trying to insert) into a
I have the following query for inserting values into my tutor table: INSERT INTO
When inserting values into my table what do I edit here? Do I delete
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
I'm experiencing a problem inserting values into a SQLite database. The data I download

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.