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

blank ,space and null


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

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Mon May 31, 2010 11:40 pm
Reply with quote

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
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Tue Jun 01, 2010 12:10 am
Reply with quote

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.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 01, 2010 1:57 am
Reply with quote

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.
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Tue Jun 01, 2010 11:06 am
Reply with quote

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
Back to top
View user's profile Send private message
guptae

Moderator


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

PostPosted: Tue Jun 01, 2010 1:00 pm
Reply with quote

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
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Tue Jun 01, 2010 1:04 pm
Reply with quote

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.
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Tue Jun 01, 2010 2:54 pm
Reply with quote

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
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Jun 01, 2010 3:46 pm
Reply with quote

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..
Back to top
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Tue Jun 01, 2010 4:08 pm
Reply with quote

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
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Jun 01, 2010 4:48 pm
Reply with quote

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.. icon_evil.gif

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

To start with...Read this
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/dsnapk10/TBLRCMPASS?SHELF=&DT=20070123230158&CASE=&ScrollTOP=TBLRCMPASS#TBLRCMPASS
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 01, 2010 8:43 pm
Reply with quote

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.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
Search our Forums:

Back to Top