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 5944899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:36:20+00:00 2026-05-22T16:36:20+00:00

I have a number column on a table called SampleTable which is defined as

  • 0

I have a number column on a table called SampleTable which is defined as follows

ID Number(10) DEFAULT 1

I have a trigger on different table(SomeTable) and UPDATE EACH ROW (Trigger – :New.ID) which inserts value from that table(SomeTable) into the SampleTable.

Sometimes the ID from SomeTable can be NULL and I wanted to SampleTable to insert the default value 1 in my case.

But it inserts NULL(Blankspace) on the table.

I am kinda new to PL/SQL so any help is greatly appreciated.

  • 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-05-22T16:36:21+00:00Added an answer on May 22, 2026 at 4:36 pm

    A column default is only used if the column is not specified in the insert:

    insert into sampletable (othercol) values ('x'); -- ID will default to 1 here
    

    It is not used if the column has been specified, even if a NULL has been passed in:

    insert into sampletable (othercol, id)
    values ('x', null); -- ID will be set to null here
    

    To deal with this, your trigger can do this:

    insert into sampletable (othercol, id)
    values ('x', coalesce(:new.id,1));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with a binary column which stores files of a number
I have a table called Billing , which is basically a receipt (for different
I currently have a table called User which has a id column which is
We have a table called with a column which is purely HTML. I need
I have a column on a table [SampleTable] called [MyColumn] and i would like
I have a table of many values where one column has the WO Number,
I have a table with the only relevant column being completionDate, a number of
I have a number of tables that use the trigger/sequence column to simulate auto_increment
i have a list 1 column and 100 rows each with a number the
i have a number of tables with a column called OrderId . I have

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.