sqlstored-proceduresdb2

Cannot drop DB2 stored procedure due to undefined name error


I have a stored procedure for DB2. I'm unable to drop the procedure. I'm getting the below error while executing the DROP PROCEDURE <PROCEDURE_NAME> command.

Error:

DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=MYSCHEMA.MyProcedure, DRIVER=3.50.152 Message: "MYSCHEMA.MyProcedure" is an undefined name. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.50.152

Procedure details:

Command executed:

DROP PROCEDURE MYSCHEMA.MyProcedure;

Error:

"MYSCHEMA.MyProcedure" is an undefined name. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.50.152

Additional information:

Question

Why am I getting this error and how can I successfully drop the procedure?


Solution

  • DB2 is generally case-sensitive and folds ordinary identifiers to uppercase. Use, delimited identifiers to keep the exact capitalization:

    DROP PROCEDURE MY_SCHEMA."MyProcedure";