Table with System Default

Posted on 2011-10-14
Last Modified: 2012-05-12
I have a table with a system default attached to a date field - each time I insert a record and the date is passed as null the field automatically gets populated with the current date time stamp - I need someway of removing that trigger.

Question by:abuyusuf35
    LVL 76

    Accepted Solution

    Is it a trigger or a default column value?

    If a trigger, just find it and drop it (assuming this is all it does).
    If a default value, just set it to null.
    drop table tab1 purge;
    create table tab1(col1 char(1), col2 date default sysdate);
    insert into tab1(col1) values('a');
    select * from tab1;
    alter table tab1 modify col2 default null;
    insert into tab1(col1) values('b');
    select * from tab1;

    Open in new window

    LVL 3

    Expert Comment

    Table name: YOUR_TABLE
    Owner of the table: MY_USER

    1) Find the trigger name.

    select trigger_name from user_triggers
    where table_owner = 'MY_USER' and table_name = 'YOUR_TABLE';

    2) If you have just one trigger then you should either disable the trigger or drop it.

    To disable it you should execute: alter trigger MY_USER.<TRIGGER_NAME> disable;

    To drop it you should execute: drop trigger MY_USER.<TRIGGER_NAME>;

    3) If you find more than one trigger then more troubleshooting is required.

    LVL 76

    Expert Comment

    by:slightwv (䄆 Netminder)
    >>If you have just one trigger then you should either disable the trigger or drop it.

    Before you just disable it or drop it (already suggested), you need to verify setting this date is all it does.

    It might do a lot more that might impact your system.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
    Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
    Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
    Via a live example, show how to take different types of Oracle backups using RMAN.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now