[Wranglers] Passing a table name as a variable to Snowflake Stored Procedure

Ali, Saqib docbook.xml at gmail.com
Wed Jan 29 22:44:41 UTC 2025


I am trying to define a Stored Procedure in Snowflake as follows. But it is
erroring out on the variable binding for :table_name. Error: Syntax error:
unexpected 'into'.

How do I achieve this?

CREATE OR REPLACE PROCEDURE SP__INSERT_TO_CUSTOMERS(table_name varchar)
  RETURNS string
  LANGUAGE SQL
AS

BEGIN

insert into :table_name (customer_name)
    select distinct
      customer_name
    from orders;

RETURN 'SUCCESS';
END;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://analyticsengineering.net/pipermail/wranglers/attachments/20250129/3707b305/attachment.htm>


More information about the Wranglers mailing list