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
 

 

Handling -305 while using cursors.

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

New User


Joined: 14 Aug 2007
Posts: 38
Location: Bangalore

PostPosted: Wed Dec 26, 2007 3:59 pm    Post subject: Handling -305 while using cursors.
Reply with quote

Hi All,

I recently came across a situation where I am declaring a cursor for a column declared as NULL. Now when I try to fetch this value into a variable I am getting a -305 SQL error code. I saw many examples of how to avoid -305 error when NOT USING A CURSOR, so I tried to use an NULL indicator. Since I am using/declaring a cursor I am not aware as to how to exactly use this NULL indicator. I need your help/suggestions.

Thank you,
Manjunath
Back to top
View user's profile Send private message

abhishekmdwivedi

New User


Joined: 22 Aug 2006
Posts: 95
Location: india

PostPosted: Wed Dec 26, 2007 4:23 pm    Post subject: Reply to: Handling -305 while using cursors.
Reply with quote

This would help you :

http://ibmmainframes.com/viewtopic.php?t=23676&highlight=305
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1224
Location: Israel

PostPosted: Wed Dec 26, 2007 4:37 pm    Post subject:
Reply with quote

Use null values in FETCH just as you do in SELECT

FETCH cursor INTO :VAR1:IND1, :VAR2:IND2

Quote:
Similarly, if :V1:V2 is specified in a FETCH or SELECT INTO statement, and if the value returned is null, V1 is
not changed and V2 is set to -1 or -2. It is set to -1 if the value selected was actually null. It is set to -2 if
the null value was returned because of numeric conversion errors or arithmetic expression errors in the
SELECT list of an outer SELECT statement. It is also set to -2 as the result of a character conversion error.
If the value returned is not null, that value is assigned to V1, and V2 is set to zero (unless the assignment to
V1 requires string truncation, in which case V2 is set to the original length of the string). If an assignment
requires truncation of the seconds part of a time, V2 is set to the number of seconds.
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 ON ERROR handling soundarr PL/I & Assembler 2 Wed May 11, 2016 3:37 am
No new posts Exception Handling in Native Stored P... Mariraj DB2 1 Thu Feb 25, 2016 4:08 am
No new posts Handling Rexx Abend trushant.w CLIST & REXX 3 Thu Jan 08, 2015 6:42 pm
No new posts Handling a string more than 250 chara... prasadchikane CLIST & REXX 3 Fri Nov 07, 2014 11:12 am
No new posts Handling Variable length files in SAS... mushreyas All Other Mainframe Topics 7 Fri Oct 31, 2014 11:12 am


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