× 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.



Hi,

IMHO if NULLs are not needed I'd avoid them and define the columns with NOT
NULL WITH DEFAULT.
Handling Null values correctly will slow down performance. Null Values are
special values that are outside of the valid range. Null values are stored
in a separate flag list, where a bit is set to *ON or *OFF depending if the
field contains a Null value or not. That means NULL values require an
additional check.

In SQL Null values in a Select ... Into or a Fetch statement must be handled
over indicator variables.
An indicator variable must be defined as 5I 0 and must be specified
immediately only seperated by a blank (and not by a comma) after the host
variable that will hold the result. If a NULL-Value is returned the
indicator variable is set to -1 otherwise the indicator variable is returned
with *ZEROS:

C/EXEC SQL Select MyField1, MyField2
C+ into :MyHostVar1 :IndVar1, :MyHostVar2 :InVar2
C+ From ....
C/End-Exec
/Free
If IndVar1 < *Zeros; //Null-Value in MyField1
//Handle NullValue
EndIf;
/End-Free

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Bob Anderson
Gesendet: Monday, April 23, 2007 20:47
An: rpg400-l@xxxxxxxxxxxx
Betreff: Question about SQL and Nulls


Good Afternoon,
I am working with a new table design and wonder about the wisdom of
using Null capable fields in the design.

Is it worth the trouble making fields Null capable and if so how do you
handle the fields in a Select Into or an Update operation operation.

I know I will need Null indicators and such but I wondering if it is worth
it.

Thanks

Bob Anderson
IT Guy
Kent Sporting Goods
433 Park Ave. S
New London OH 44851
419-929-7021 x315
email: banderson@xxxxxxxxxxxxxxxxxxx



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.