Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Setting NULLs in the Table.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Tue Apr 01, 2008 10:53 pm    Post subject: Setting NULLs in the Table.
Reply with quote

Can anyone help me for UPDATEing a table by setting a particular field as NULL.

say i have a table MYTABLE in which a nullable column MYCOL1 is there. the data is in the table. now i want to UPDATE the table and place NULL values in the MYCOL1.

using cobol program we may do it by passing -1 to the null-indicators but, what about a QUERY?
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 Apr 01, 2008 11:59 pm    Post subject: Re: Setting NULLs in the Table.
Reply with quote

the_gautam wrote:
Can anyone help me for UPDATEing a table by setting a particular field as NULL.

say i have a table MYTABLE in which a nullable column MYCOL1 is there. the data is in the table. now i want to UPDATE the table and place NULL values in the MYCOL1.

using cobol program we may do it by passing -1 to the null-indicators but, what about a QUERY?


update mytable set mycol1 = null;

Of course it may be wise to include a where clause.
Back to top
View user's profile Send private message
byearun

New User


Joined: 25 Jul 2005
Posts: 17

PostPosted: Tue Apr 08, 2008 11:52 pm    Post subject:
Reply with quote

I think it will not work. We tried the same in SPUFI. But it failed with SQLCODE -407
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 Apr 08, 2008 11:56 pm    Post subject:
Reply with quote

byearun wrote:
I think it will not work. We tried the same in SPUFI. But it failed with SQLCODE -407


Did you even bother to lookup -407 sqlcode?

You can only set a nullable column to null!
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Apr 08, 2008 11:57 pm    Post subject:
Reply with quote

Hello,

Quote:
But it failed with SQLCODE -407
You would get this any way you tried, i believe. . . The column is not nullable. . .

It is usually a good idea to look up the error code . . .
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Tue Apr 08, 2008 11:59 pm    Post subject:
Reply with quote

Quote:
SQLCODE -407

Here, updating column shouldn't be defiened as NOT NULL...
Back to top
View user's profile Send private message
byearun

New User


Joined: 25 Jul 2005
Posts: 17

PostPosted: Wed Apr 09, 2008 12:11 am    Post subject:
Reply with quote

Yes, I was trying to update the column which is defined as NOT NULL. How this can done thru SPUFI.
Back to top
View user's profile Send private message
byearun

New User


Joined: 25 Jul 2005
Posts: 17

PostPosted: Wed Apr 09, 2008 12:14 am    Post subject:
Reply with quote

To more specific, i want to update a null value in the column which has defined as NOT NULL
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Apr 09, 2008 12:17 am    Post subject:
Reply with quote

Hello,

Quote:
To more specific, i want to update a null value in the column which has defined as NOT NULL
This cannot be done.

Someone went to some length to define the column as not nullable. Why would you believe it was acceptable for you to force the column to null?

It is probably time for you and your peers to talk with your manager and/or the dba(s) and decide which way the definition should be.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 18 Thu Jul 13, 2017 2:11 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us