Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    42

    Unanswered: 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.

  2. #2
    Join Date
    Feb 2007
    Posts
    42
    how and where will i cast values? in what statements?

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  4. #4
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    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/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •