Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2016

    Unanswered: SQLCODE -206/DB2 using column names for INSERT

    SQLADD = 'Insert into LIBNAME/FILENAME ' +
    (FIELDB1, FIELDB2) +
    values (FIELDA1, +
    Execute immediate 'colon'SQLADD;

    SQLCODE = -206 (columns not in specified table) SQLSTATE = 42703. If I put COLONS in front of FIELD1A and FIELDA2, SQLCODE = -312 (host variable not usable).

    The file containing FIELDA1 and FIELDA2 was READE in a previous subroutine and both have values - ran source in DEBUG and both fields have their expected values.

    Is this a case where column names are not allowed in the SQLADD statement? If so, what is the work around? I have also tried putting the FIELDA1 and FIELDA2 values into variables and use the variable names in the values clause --- same error, SQLCODE -206.

    Last edited by DonnaMarie; 06-24-16 at 16:21.

  2. #2
    Join Date
    Jan 2003
    Provided Answers: 5
    Statement should look like this:

    SET SQLADD = 'insert into tabschema.tabname (field1,field2) values (' || field_a_1 ||','|| field_a_2 ||')'


Posting Permissions

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