var step0=`select INGESTION_SUCCESSFUL,ingestion_uuid from FILE_INGESTION_HISTORY where ingestion_uuid=(
select ingestion_uuid from registration where registry_subject_uuid=:1
qualify row_number() over( order by dnb_latest_received_dt desc)=1)`;
var statement0=snowflake.createStatement( {sqlText: step0,binds: [PARAM_REG_SUB_UUID]} );
variable1= statement0.execute();
variable1.next();
ingsindc=variable1.getColumnValue(1);
ingsuuid=variable1.getColumnValue(2);
when i try to use above ingsuuid in sql where clause it is throwing error
var step1= create or replace temporary table FN_IGSN_REG_LBV1 as select * from registration where ingestion_uuid=**ingsuuid** and (DELETE_INDC=0) qualify row_number() over (partition by REGISTRATION_HASH_KEY order by dnb_latest_received_dt desc, row_created_tmst desc, registration_uuid desc) = 1;
var statement1=snowflake.createStatement( {sqlText: step1} );
statement1.execute();
Binding a variable to a SQL statement allows you to use the value of the variable in the statement.
You can bind NULL values as well as non-NULL values.
The data type of the variable should be appropriate for the use of the value in the SQL statement. Currently, only JavaScript variables of type number, string, and SfDate can be bound. (For details about the mapping between SQL data types and JavaScript data types, see SQL and JavaScript Data Type Mapping.)
Here is a short example of binding:
var stmt = snowflake.createStatement(
{
sqlText: "INSERT INTO table2 (col1, col2) VALUES (?, ?);",
binds:["LiteralValue1", variable2]
}
);
More details: https://docs.snowflake.com/en/sql-reference/stored-procedures-usage.html#binding-variables