Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts Setting Font Type for XMIT satish.ms10 All Other Mainframe Topics 3 Fri Sep 15, 2017 10:01 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am
No new posts Finding IMS resource blocker after se... Hooman24 IMS DB/DC 1 Wed Aug 16, 2017 9:17 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us