I would like to run a select query in a Snowflake SQL Stored Procedures (not Javascript) using dynamic SQL. Is this possible?
What I am looking to do is pass in a database name as a parameter. I then want to select all schema names from INFORMATION_SCHEMA.SCHEMATA for that database. I would like to use the input parameter value for the database name to fully qualify the table. For example, DBNAME.INFORMATION_SCHEMA.SCHEMATA where DBNAME is the name of my input parameter.
I would then like to loop through the results and for each schema do some code.
I find lots of Dynamic SQL examples for Javascript but I can't find one for a SQL stored procedure (language SQL) because it is so new. Please let me know if this is possible and an example if possible. Thanks!


