Customer Portal

Can't call POSTGRES function using DBEXECUTE

Comments 2

  • Avatar
    admin
    0
    Comment actions Permalink
    Generally speaking, when a user migrates a database that includes so-called user-defined function (function or procedure), he just needs to make sure that he has initialized the function in his new database using the appropriate syntax (Oracle SQL slightly differs from PostgreSQL). However, DBExecute setup should then work without any change. Please refer to CloverETL Designer Documentation (chapter "Calling Stored Procedures and Functions"):
    DBExecute Documentation

    It means that we define the function in Postgres database (in PostgreSQL language), for example, this way:

    CREATE OR REPLACE 
    FUNCTION delete_function()
    RETURNS void AS'

    DELETE FROM data
    WHERE num=70;
    ' LANGUAGE SQL;


    And then we can call it from CloverETL by executing this:

    {call delete_function()};


    In your case, I believe, the first step has been already done (most likely outside CloverETL Designer, but it can be executed in DBExecute as well), therefore you can simply call the function using {call delete_function()};

    In other words, even though SQL syntax of the function varies in different databases, DBExecute setup of calling the function remains the same. (Even though PostgreSQL usually uses SELECT for calling function).

    Best Regards,
  • Avatar
    mrmason@us.ibm.com
    0
    Comment actions Permalink
    Thank you. This is the answer. I didn't see any syntax for functions without any input parameters in the documentation. The issue was I was missing the '()' at the end of the function name, which was not needed when the job was connected to the Oracle database.

    I will also note for future readers that I do have the "call as stored procedure" attribute selected.

Please sign in to leave a comment.