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

  • SEARCH
  • Home
  • 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 639835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:53:12+00:00 2026-05-13T20:53:12+00:00

I have an oralcle SP forced on me that will not accept an empty

  • 0

I have an oralcle SP forced on me that will not accept an empty parameter in an update. So if I wanted to set a value back to the default of (”) it will not let me pass in the empty string. Is there a keyword you can use such as default, null, etc that oracle would interpret back to the default specified for a particular column?

  • 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-13T20:53:12+00:00Added an answer on May 13, 2026 at 8:53 pm

    Sometimes things are just as simple as you hope they might be.

    First, a table with a default value …

    SQL> create table t23 (
      2      id number not null primary key
      3      , col_d date default sysdate not null )
      4  /
    
    Table created.
    
    SQL> insert into t23 values (1, trunc(sysdate, 'yyyy'))
      2  /
    
    1 row created.
    
    SQL> select * from t23
      2  /
    
            ID COL_D
    ---------- ---------
             1 01-JAN-10
    
    SQL>
    

    Next a procedure which updates the default column …

    SQL> create or replace procedure set_t23_date
      2      ( p_id in t23.id%type
      3        , p_date in t23.col_d%type )
      4  is
      5  begin
      6      update t23
      7      set col_d = p_date
      8      where id = p_id;
      9  end;
     10  /
    
    Procedure created.
    
    SQL>
    

    … but which doesn’t work as we would like:

    SQL> exec set_t23_date ( 1, null )
    BEGIN set_t23_date ( 1, null ); END;
    
    *
    ERROR at line 1:
    ORA-01407: cannot update ("APC"."T23"."COL_D") to NULL
    ORA-06512: at "APC.SET_T23_DATE", line 6
    ORA-06512: at line 1
    
    
    SQL>
    

    So, let’s try adding a DEFAULT option …

    SQL> create or replace procedure set_t23_date
      2      ( p_id in t23.id%type
      3        , p_date in t23.col_d%type )
      4  is
      5  begin
      6      if p_date is not null then
      7          update t23
      8          set col_d = p_date
      9          where id = p_id;
     10      else
     11          update t23
     12          set col_d = default
     13          where id = p_id;
     14      end if;
     15  end;
     16  /
    
    Procedure created.
    
    SQL>
    

    … and lo!

    SQL> exec set_t23_date ( 1, null )
    
    PL/SQL procedure successfully completed.
    
    SQL>
    SQL> select * from t23
      2  /
    
            ID COL_D
    ---------- ---------
             1 28-FEB-10
    
    SQL>
    

    I ran this example on an 11g database. I can’t remember when Oracle introduced this exact support for DEFAULT, but it has been quite a while (9i???)

    edit

    The comments are really depressing. The entire point of building PL/SQL APIs is to make it easier for application developers to interact with the database. That includes being sensible enough to rewrite stored procedures when necessary. The big difference between building something out of software and, say, welding cast-iron girders together is that software is malleable and easy to change. Especially when the change doesn’t alter the signature or behaviour of an existing procedure, which is the case here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of code value tables that contain a code and a
We have an Oracle database here that's been around for about 10 years. It's
I have several Oracle queries that perform well when run through SQL*PLUS. However when
I have a parent object (part of a DAL) that contains, amongst other things,
I have an ETL that is importing tables from Oracle to SQL 2008 using
I have oracle backend for my application. The schema is designed such that I
In an Oracle ADF web app I have a popup that users access in
I have a custom JTree implementation that implemts convertValueToText . This implementation depends on
We have an SP timer job that was running fine for quite a while.
First, I know that the sql statement to update table_a using values from table_b

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.