greypanda
greypanda

Reputation: 123

How to get name of executing stored procedure in Snowflake?

Does snowflake have function which returns name of the current stored procedure like the following in SQL Server.

SELECT OBJECT_NAME(@@PROCID)

I am just trying to build a logging table to log all statements that are executed inside a stored procedure this is for monitoring purpose i.e. which statement within stored procedure failed and how long queries are taking to run. If Snowflake has something out-of-box OR a recommended way of doing it please share.

Upvotes: 2

Views: 1621

Answers (1)

waldente
waldente

Reputation: 1434

Try this from within your stored procedure:

const procName = Object.keys(this)[0];

Also see this related post.

Upvotes: 2

Related Questions