IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

NOT NULL with Default


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
royalchm

New User


Joined: 15 Nov 2007
Posts: 29
Location: Bangalore

PostPosted: Tue Dec 01, 2009 3:45 pm
Reply with quote

if we specified "NOT NULL with Default" it will take default values in the field if the field is null
my questions are
1) can we set any default value instead of '0' for numeric and 'NULL' for alpha?
2) if we use NOT NULL with Default, then 0 is a valid data in the same filed the how we can differentiate.
eg: Empid is created with NOT NULL WITH DEFAULT option and field is a numeric field then for empid '0' is valid empid, then how we can find out the null values through querry?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Dec 01, 2009 3:51 pm
Reply with quote

Quote:
then how we can find out the null values through query?


review the application design
if a column is NOT NULL, it will never have a ... NULL VALUE

NULL ==> without an assigned value
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Dec 01, 2009 3:59 pm
Reply with quote

you need to review (learn?) the meaning of NULL within DB2 context:

null. A special value that indicates the absence of information or data.

nul or the null character x'00', or low-values (cobol)

a numeric zero is a valid numeric character.

very little of your post was accurate.

NOT NULL with Default is a column attribute which says if during an INSERT, no value is provided, the Default will be inserted by DB2.

INSERT syntax for NULL would be two ,, denoting no value - or NULL - as the insert value for the column.

there is syntax for determining if a column is NULL - check out the vsn 8 application programmers guide and the vsn 8 sql reference.

if you using a different version then the DB2 Library will point you to the version you are interested in.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Running a Job with the Default User ID JCL & VSAM 2
No new posts Change Default Scroll Setting TSO/ISPF 1
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
No new posts Define default volume for DSN storage... JCL & VSAM 8
Search our Forums:

Back to Top