Re: NULLS with ORACLE

From: Paul Roberts <proberts_at_isc901.jsc.nasa.gov>
Date: 1995/08/01
Message-ID: <3vlmv5$2r0_at_killerbee.jsc.nasa.gov>#1/1


Anthony Foo writes:

>
> NULLS with ORACLE
>
> apxafoo_at_technet.sg (Anthony Foo)
> 1 Aug 1995 05:34:42 GMT
> Technet, Singapore
>
> Newsgroups:
> comp.databases.oracle
> Wonder if anyone can help me. I am currently writing an application
> in PB4.0 that is accessing the Oracle database (ver 7.0) on my
 company's
> AIX machine.
> The tables in the database are defined such that all columns are set
 with
> NOT NULL constraint. However, when I create a datawindow that has,
 say, 5
> columns out of 15 columns in a table and I do a insertrow and then an
 update,
> Oracle return with the error that there are null values in the insert
> statement. What actually happened was that PB 4.0 send an insert
 statement with
> only the 5 columns in the datawindow. The remaining 10 columns that
 were not
> passed, Oracle tried writing nulls into them, thus the error.
> I had tried altering the table with the column set as NOT NULL DEFAULT
 SPACES
> but Oracle return telling me I can't set the column as such. It's
 either I set
> the column as NOT NULL or I accept NULL with default.
> Question is, is there anyway I can overcome this problem without
 altering
> the columns' NOT NULL constraint? I had thought of a possibility which
 is
> to select all the columns in the table even if I only needed 5 out of
 15
> columns in the datawindow. I DON'T wish to use this solution as it
 means
> nightmare doing maintenance and delay in retrieval.

Anthony, get someone to write you a database trigger to insert values in any NULL columns _before_ they are inserted into the database. This should solve your problem. Just be sure to document that you have done this, any why. Otherwise, someone else will drop it later.

Hope this helps!

    _   _  _ _  __    : Paul Roberts                 
   |_  |_|  |  |      : Programmer / Analyst        
    _| | | _|_ |__    : proberts_at_isc901.jsc.nasa.gov 

Scientific Applications International Corporation

   (An employee-owned company)

  The opinions expressed are my own, and not necessarily   the views of SAIC, NASA, or the U.S. government. Received on Tue Aug 01 1995 - 00:00:00 CEST

Original text of this message