0

I'm using AppConnect v12 and I'm trying to write a DB stored procedure from esql using the below piece of code:

CREATE PROCEDURE getCustomer_SP (
    IN custNo INT,
    INOUT responseCode CHAR)
RETURNS INT
LANGUAGE DATABASE
EXTERNAL NAME "DBSchemaDev.SPName";

where the DBSchema varies from environment to another, so I need it to be variable according to the environment and I will get its value from config. file For example, for test environment, it is called DBSchemaTest and so on.. I tried the below

DECLARE DBSchema CHARACTER 'DBSchemaDev';
CREATE PROCEDURE getCustomer_SP (
    IN custNo INT,
    INOUT responseCode CHAR)
RETURNS INT
LANGUAGE DATABASE
EXTERNAL NAME DBSchema || ".SPName";

but it is not working, I tried also below

DECLARE DBSchema CHARACTER 'DBSchemaDev';
CREATE PROCEDURE getCustomer_SP (
    IN custNo INT,
    INOUT responseCode CHAR)
RETURNS INT
LANGUAGE DATABASE
EXTERNAL NAME "{DBSchema}.SPName";

but it is not working as well, so I was wondering if there is possibility to use variables in the EXTERNAL NAME field

1 Answer 1

0

Solution found. I used to call the stored procedure as below

DECLARE DBSchema CHARACTER 'esb'; --where esb is retrieved from config. file
CALL getCustomer_SP(custNo, responseCode) IN Database.{DBSchema};

where I removed the schema name from the stored procedure definition as below

    CREATE PROCEDURE getCustomer_SP (
    IN custNo INT,
    INOUT responseCode CHAR)
RETURNS INT
LANGUAGE DATABASE
EXTERNAL NAME "SPName";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.