If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > The data types of corresponding columns are not compatible

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-08-07, 16:59
wishlister wishlister is offline
Registered User
 
Join Date: Feb 2007
Posts: 42
The data types of corresponding columns are not compatible

if(typ='A') then
INSERT INTO emp(empno, NAME, typ, rate, hrs)
VALUES (@empno, @NAME, @typ, @rate, @hrs);
FETCH Cur INTO @empno, @NAME, @typ, @rate, @hrs;

elseif(typ='B') then
INSERT INTO emp(empno, NAME, typ, ans, comm)
VALUES (@empno, @NAME, @typ, @ans, @comm);
FETCH Cur INTO @empno, @NAME, @typ, @ans, @comm;
end if;

error//The data types of corresponding columns are not compatible in a fullselect that includes a set operator or in the multiple rows of a VALUES clause of an INSERT or fullselect.
Reply With Quote
  #2 (permalink)  
Old 03-08-07, 18:47
wishlister wishlister is offline
Registered User
 
Join Date: Feb 2007
Posts: 42
how and where will i cast values? in what statements?
Reply With Quote
  #3 (permalink)  
Old 03-09-07, 04:40
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Could you please post the complete error message, table definitions, cursor declarations, and some information to your DB2 environment?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 03-10-07, 09:21
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by wishlister
INSERT INTO emp(empno, NAME, typ, rate, hrs)
VALUES (@empno, @NAME, @typ, @rate, @hrs);
Make sure that the datatypes of e.g. variable @NAME and column NAME match.
Just check the column datatypes in the catalog.

(For example, column empno might be a CHAR(4) while variable @empno might be an INTEGER; those datatypes are incompatible.)
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On