Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes

Author Message
l.nethaji

New User

Joined: 16 Mar 2008
Posts: 90

 Posted: Mon May 31, 2010 11:40 pm    Post subject: blank ,space and null hi, this may be simple question to ask. But i still confuse on null,space or blank. please correct me if i am wrong . Null - A table student is created with 2 colum name and marks . if i insert say name alone . then there is no values in marks .so its called us Null. SPACE - i create a table student new with 2 column name and marks. i insert value say (alen,10) . Now i delete the value 10 from the marks col in student new table . can i say the col value is now spaces and not null. Thanks , l.nethaji

Craq Giegerich

Senior Member

Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

Posted: Tue Jun 01, 2010 12:10 am    Post subject: Re: blank ,space and null

 l.nethaji wrote: hi, this may be simple question to ask. But i still confuse on null,space or blank. please correct me if i am wrong . Null - A table student is created with 2 colum name and marks . if i insert say name alone . then there is no values in marks .so its called us Null. SPACE - i create a table student new with 2 column name and marks. i insert value say (alen,10) . Now i delete the value 10 from the marks col in student new table . can i say the col value is now spaces and not null. Thanks , l.nethaji

It would depend on how the columns are defined, are they defined as "NOT NULL WITH DEFAULT"?

You can not delete a value from a column, you can set it to a different value or to NULL if it is defined to contain allow a NULL.
dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

 Posted: Tue Jun 01, 2010 1:57 am    Post subject: Hello, Space and Blank are the same value - on the mainframe this is x'40'. There is no value for NULL - NULL is the absence of any value at all. I believe you need to review what NULL is and the rules for NULLs. Personally, i recommend NULLs not be used.
l.nethaji

New User

Joined: 16 Mar 2008
Posts: 90

 Posted: Tue Jun 01, 2010 11:06 am    Post subject: Reply to: blank ,space and null hi, Thanks for the reply. if the column MARKS is not declared as NOT NULL WITH DEFAULT. If i create a table student with 2 column( name and marks) . insert a row into it say (babu,10). IF i use delete marks from student . Whether the marks column will have space or it would be null. Please let me know when the column is said to be blank or space . Please correct me if am wrong Thanks in advance L.Nethaji
guptae

Moderator

Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

 Posted: Tue Jun 01, 2010 1:00 pm    Post subject: Hello Netaji, I suggest you to brush up your skills in Db2. Just check you cant delete value from 1 column you can update it. Please read the manuals and let us know if you not clear
GuyC

Senior Member

Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

Posted: Tue Jun 01, 2010 1:04 pm    Post subject: Re: blank ,space and null

as said :
Craq Giegerich wrote:
 l.nethaji wrote: IF i use delete marks from student

You can not delete a value from a column, you can set it to a different value or to NULL if it is defined to contain allow a NULL.
l.nethaji

New User

Joined: 16 Mar 2008
Posts: 90

 Posted: Tue Jun 01, 2010 2:54 pm    Post subject: Reply to: blank ,space and null Hi, Thanks for the help. I now understand the delete function. One final query ,where blank or space comes into picture . I mean like which scenario these spaces or blank are used in tables in DB2. Thanks L.Nethaji
Escapa

Senior Member

Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

Posted: Tue Jun 01, 2010 3:46 pm    Post subject: Re: Reply to: blank ,space and null

 l.nethaji wrote: Hi, One final query ,where blank or space comes into picture . I mean like which scenario these spaces or blank are used in tables in DB2.

Setting column value to blank (all spaces) is same as you set it to any other value..
l.nethaji

New User

Joined: 16 Mar 2008
Posts: 90

 Posted: Tue Jun 01, 2010 4:08 pm    Post subject: Reply to: blank ,space and null Hi, Could you please let me know how the spaces or blank is set to a column. Suppose i have table t with 2 column name (varchar ) and marks(int eger ), How do i make sure if the name and marks are set to spaces . Is ther any query for the same to insert a space to the column mentioned above. Thanks , L.Nethaji
Escapa

Senior Member

Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

Posted: Tue Jun 01, 2010 4:48 pm    Post subject: Re: Reply to: blank ,space and null

 l.nethaji wrote: Hi, Could you please let me know how the spaces or blank is set to a column. Suppose i have table t with 2 column name (varchar ) and marks(int eger ), How do i make sure if the name and marks are set to spaces . Is ther any query for the same to insert a space to the column mentioned above.

You can not assign any type of value to any datatype column like roaming in park..

I expect you to try these things on your own as you are software engineer with cobol\db2 skills.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/dsnapk10/TBLRCMPASS?SHELF=&DT=20070123230158&CASE=&ScrollTOP=TBLRCMPASS#TBLRCMPASS
dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

Posted: Tue Jun 01, 2010 8:43 pm    Post subject:

Hello,

 Quote: How do i make sure if the name and marks are set to spaces .
You don't. . . Why would you believe it is desirable (or even possible) to have spaces in a column that is defined as numeric?

You need to step back and review your understanding of how database works.

Suggest you follow the link at the top of the page to "IBM Manuals", find the SQL Reference for your release of DB2 and read everything about how to define tables/columns and hot to place/change values in these columns. If you find something in the documentation that is not clear, post what you found and your doubt. Someone shold be able to clarify.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm GetObjectArrayElement returns NULL Majid Hussain Java & MQSeries 2 Wed Mar 30, 2016 2:59 am How to find Table-space and Index-spa... venksiv DB2 5 Wed Feb 03, 2016 6:16 pm

 © 2003-2016 IBM MAINFRAME Software Support Division
 Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us