insert statement is inserting value instead of null
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: insert statement is inserting value instead of null

  1. #1
    Join Date
    Mar 2008
    Posts
    6

    insert statement is inserting value instead of null

    we have two environment one is dev and other is testing..

    In testing environment one insert staement inserting value "1/1/0001 5:30:00.000000 AM +05:30" instead of null.
    In development environment the same insert staement inserting null......this is the correct one...


    this insert statement is the part of one package....


    both the places code is same...

    I am not aware of any setting that we can do at session level or database level for setting default date value..


    Please help me to find out the reason behind it...

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    3,967
    You can set a value on insert either by having a default value on a column or by having an insert/update trigger that sets the value in a column. So if the columns get a value on one database but not the other then they are by definition not exactly the same.

    Here is some code that will help you to see if the table have a default value on the column in question.

    Code:
    set heading off;
    set echo off;
    Set pages 999;
    set long 90000;
    set linesize 120
    col text format a115
    accept object_type  prompt "OBJECT TYPE:"
    accept object_name  prompt "OBJECT NAME:"
    accept schema_owner prompt "SCHEMA OWNER:"
    select dbms_metadata.get_ddl(UPPER('&object_type'),
    UPPER('&object_name'),UPPER('&schema_owner')) text from dual;
    this space intentionally left blank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width