Last updated
Last updated
EXEC(stmt) EXEC(stmt, binds[]) EXEC(stmt, opts{}) EXEC(stmt, binds[], opts{})
The string of the SQL statement to execute.
An array with the values or the variables to bind into the SQL statement.
This is a Javascript object to describe how the values returned by the exec should be formated, this is used for SELECT statements.
The following tables describe, how arguments should be sent to opts parameter in EXEC call:
The following code examples illustrates how EXEC works.
Oracle
Snowflake
Oracle
Snowflake
Oracle
Snowflake
For the following sample, EXEC call returns [12], with object destructuring ID_VAR
stores 12:
The following two EXEC calls are alternative ways for the previous sample without object destructuring:
Object destructuring also works with bindings as you may note on these statements (EXEC call returns [12, "MOUSE"] values):
To obtain the actual result set returned by Snowflake, you can use this synaxis:
Oracle
Snowflake
This is still a work in progress. The transformation to properly store the record values will be:
No issues were found.
For all the samples, SnowConvert helpers Code were removed. You can find them
You might be interested in .
: Object may not work.
: DBMS_OUTPUT.PUTLINE check UDF implementation
{row:2}
With this option, it always returns a copy of the ResultSet regardless of the number of rows returned by the EXEC.
EXEC function is a helper used to execute dynamic SQL inside a procedure.
{ }
When opts is empty or not sent to exec call, the data will be returned inside an array.
{vars: 0}
This has the same effect as the default option. It will return the data inside an array.
{vars: 1}
This is used when a query returns just one column and one row. EXEC will return the value directly. This is equivalent to EXEC(stmt)[0]
{rec:recordVariable}
{row: 1}
{sql:0}
Used when you want to store the values returned by the query inside a record. Translation of records is described in . Record variable should be passed as an argument.
This option returns a copy of ResultSet, this means that the object returned contains the methods described in .
It makes sure that the is not modified after executing the statement.