Resolution for SQL code -333



IBM's flagship relational database management system

Resolution for SQL code -333

Postby nikesh_rai » Tue Jul 26, 2016 10:38 am

Hi Friends,

I am getting SQL error code -333 while trying to insert some values in a table. The table have a column declared as VARCHAR, and the SQL error is coming while inserting value in that column only. When I tried below option it worked fine.

INSERT INTO AAAA      
  (ACTY_DTL)                    
VALUES                            
  (VARCHAR(:GIBD728-ACTY-DTL))


Anyone can suggest me a better option for this.
Description for error code -333 is THE SUBTYPE OF A STRING VARIABLE IS NOT THE SAME AS THE SUBTYPE KNOWN AT BIND TIME AND THE DIFFERENCE CANNOT BE RESOLVED BY CHARACTER CONVERSION
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 187
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Resolution for SQL code -333

 

Re: Resolution for SQL code -333

Postby Akatsukami » Tue Jul 26, 2016 11:44 am

And the declaration of GIBD728-ACTY-DTL is?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1036
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 49 times

Re: Resolution for SQL code -333

Postby nikesh_rai » Tue Jul 26, 2016 12:34 pm

for table column is declared as below:

Column name  . . . . : ACTY_DTL                                      
Table or view name . : AAAA                              
Table/view schema  . : XXXXXXX            Column number  . . . : 10  
Column type  . . . . : VARCHAR            Column length  . . . : 3900
NULL value allowed . : YES                Updates allowed  . . : YES  
Field procedure  . . : NO                                            
Default indicator  . : Y - Null                                      
Default value  . . . :                                                
Character sub type . : B - for BIT data                              
Definition status  . : Complete                                      
                                                                     
Position in part key : N/A                                            
Partition key order  : N/A                                            
Created timestamp  . : 2011-08-26-10.50.06.577735                    
Altered timestamp  . : 2011-08-26-10.50.06.577735                    
Encode CCSID . . . . : 65535                                          


And in DCLGEN it is declared as below:

10 GIBD728-ACTY-DTL.                                      
    49 GIBD728-ACTY-DTL-LEN      PIC S9(4) USAGE COMP.    
    49 GIBD728-ACTY-DTL-TEXT     PIC X(3900).        
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 187
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Resolution for SQL code -333

Postby pranav283 » Fri Jul 29, 2016 4:00 pm

I think you have to change your code like that:

INSERT INTO AAAA      
  (ACTY_DTL)                    
VALUES                            
  (VARCHAR(:GIBD728-ACTY-DTL-TEXT))


That is, having to insert from the value contained in the TEXT field of the variable GIBD728-ACTY-DTL.
However, I am not sure whether the phrase 'VARCHAR' would be coded or not.
pranav283
 
Posts: 35
Joined: Sat Aug 30, 2014 3:52 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Resolution for SQL code -333

Postby nikesh_rai » Fri Jul 29, 2016 7:30 pm

It's VARCHAR column, you have to pass string length with the string.. my problem is how to avoid VARCHAR conversion..
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 187
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post