× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Christen, Duane wrote:

As Vern said, DBU is passing blanks as the value of the field,
not null thus the DDL default clause is not invoked, an RPG write
would have the same problem. If you wrote to a LF or index that
did not contain the field in the record format the default value
would be used.

In a quick test DBU populated the default value into a defaulted
field on the add display.

For an RPG write another possibility would be to allow the
defaulted field to contain null and set the null indicator before
the write. I would expect this to work but I have not tested it. <<SNIP>>

The last comment seems to blur /the NULL value/ concept contrasted with /the default value/ of a column. The default value is assigned only by request via SQL [e.g. the word DEFAULT for an element of the VALUES clause on INSERT], or by column omission [e.g. in SQL on the INSERT to specify a column list which omits the column name which is to be defaulted]. The null value may be the default value defined for a column, but setting any column to the null value precludes assignment of a default to that column; i.e. an assignment of no value using /the null value/ indicator is not a defaulted value, just as neither the assignment of blanks to a character column nor zero to a numeric column is a defaulted value [even if the character column was defined WITH DEFAULT '' and the numeric column was defined WITH DEFAULT 0]. Of course there is the option of just using a prior SET :HVuser = SYSTEM_USER [or set to whatever value, a literal, SESSION_USER, or USER] and then just use :HVuser in an embedded INSERT statement.

Because the SELECT column list in a VIEW can omit a column [of its based-on TABLE], an update of that VIEW from either a non-SQL or SQL interface is inherently omitting the column. For that scenario, an inserted row will cause the database to assign the default value to those columns in the TABLE [physical file] which were omitted from the VIEW. In SQL the column list can be specified directly on the INSERT INTO, and thus the omission default can be effected by omission directly on the INSERT INTO; i.e. possible outside the use of the VIEW.

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.