0
votes

I'm trying to execute the following code with Liquibase.

BEGIN ATOMIC
DECLARE I INT DEFAULT 6;
WHILE I <= 10 DO
    INSERT INTO LQBTEST.department (id,name,active) VALUES (I,"pl",1);
    SET I = I + 1;
END WHILE;
END@

I tried it with

<sql endDelimiter="@" splitStatements="false"></sql> 

which resulted in liquibase telling me that my markup was wrong then I tried:

<sqlFile endDelimiter="@"
        path="proc.sql"
        relativeToChangelogFile="true"
        splitStatements="false"
        stripComments="true"/>

results in:

Unexpected error running Liquibase: com.ibm.db2.jcc.am.SqlSyntaxErrorExc
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=pl, DRIVER=3.63.75

Help is really appreciated.

1
"pl" is a column name, not a string. 'pl' would be string. Btw: that's not PL/SQL. There is no BEGIN ATOMIC or `SET in PL/SQL.a_horse_with_no_name

1 Answers

0
votes

If you look in the DB2 Information Center, the error you are getting, -206, means "name is not valid in the context where it is used."

In this case, name corresponds to the SQLERRMC field in the error you are getting, which is pl. As @a_horse_with_no_name said, double-quoted strings are identifiers, not string literals, which is likely why you are getting the error.