Kannan Kandasamy
Kannan Kandasamy

Reputation: 13959

Using Liquibase to create snowflake storedprocedure

I am trying to create stored procedure using liquibase, but while doing liquibase update it is failing with below error:

Starting Liquibase at 11:37:58 (version 4.4.0 #11 built at 2021-06-09 16:36+0000)
Liquibase Version: 4.4.0
syntax error line 5 at position 5 unexpected '$'. [Failed SQL: (1003) create or replace procedure SP_TEST_AZURE()
    returns string
    language javascript
    as
    $$
    var sql_cmd

Is there configuration missing?

Upvotes: 2

Views: 999

Answers (1)

Lukasz Szozda
Lukasz Szozda

Reputation: 175616

The error message indicates that Liquidbase has issue with $$. I suspect:

The endDelimiter SQL attribute

Use endDelimiter in SQL for PROCEDURE and FUNCTION

An endDelimiter may be used when the changeset contains SQL to create a stored procedure or function that contains the default ';' end delimiter. To avoid incomplete statements being sent to the database, the changeset must be marked to have a different endDelimiter.

The endDelimiter must be specified for some dbms systems to run multiple statements.

Setting it to empty string: endDelimiter="" should resolve it.

Upvotes: 1

Related Questions