Search code examples
amazon-web-servicesstored-proceduresamazon-redshiftplpgsql

Redshift stored procedure is created but when called, it says column <sp_name> doesn't exist


I have created a stored procedure stg.sp_l1_l_geography_load() and I can see it under the stg schema but when I call it using

call stg.sp_l1_l_geography_load()

I get this error:

SQL Error [42703]: ERROR: column "stg.sp_l1_l_geography_load()" does not exist
Where: SQL statement "SELECT "stg.sp_l1_l_geography_load()"" PL/pgSQL function "sp_l1_l_geography_load" line 8 at assignment

Why does it even see it as a table/column?

Thanks!


Solution

  • The error was in a variable called sp_name that I had initialized with double-quotes

    sp_name := "*<sp_name>*"
    

    Making it single-quotes worked:

    sp_name := '*<sp_name>*'