murali mohan
murali mohan

Reputation: 221

Flyway fails when One procedure calls another, in DB2

The following bit of SQL, fails with flyway v5.1.3 against DB2 LUW 10.5, but it works when executed directly in DB2 using a client.

The error message:

" DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=TEST_STATUS;PROCEDURE, DRIVER=4.19.26"

Definitely a problem with flyway. Does anyone know a workaround or fix?

    CREATE OR REPLACE PROCEDURE TEST_STATUS
  (
    IN a INTEGER,
    INOUT b INTEGER,
    INOUT c INTEGER,
    INOUT d INTEGER
  )
  BEGIN


  END;


CREATE OR REPLACE PROCEDURE TEST_STATUS_MAIN
  (
    IN a    INTEGER,
    IN b INTEGER,
    IN c    INTEGER,
    OUT d BIGINT
  )
  BEGIN
    DECLARe e INTEGER DEFAULT 0;

    CALL TEST_STATUS(a, b, c, e);


  END;

Upvotes: 0

Views: 67

Answers (1)

Mark Barinstein
Mark Barinstein

Reputation: 12314

This may happen if CURRENT SCHEMA is not in the CURRENT PATH list for the session.
Let's say,
VALUES CURRENT SCHEMA returns SCHEMA1
VALUES CURRENT PATH returns "SYSIBM","SYSFUN","SYSPROC","SYSIBMADM","SCHEMA2".
The routine TEST_STATUS is created in the SCHEMA1 schema, and it's being tried to be found in the "SYSIBM","SYSFUN","SYSPROC","SYSIBMADM","SCHEMA2" list, upon an attempt to create TEST_STATUS_MAIN.

Upvotes: 0

Related Questions