jvels
jvels

Reputation: 349

Snowflake function how to input IN statment to function

I have function in Snowflake where I would like to input a variable there contains a IN statment for a query.

It works when I only have one item:

select * from table(my_function('62696'))

But I can not figure out how to do when I have more items, I have tried different ways like:

select * from table(my_function(''62696','62695''))
select * from table(my_function('\'62696\',\'62695\''))

But no of them does work.

Upvotes: 1

Views: 85

Answers (1)

jvels
jvels

Reputation: 349

I did solve it with by call the function with:

select * from table(my_function('62696,62695'))

In the function I use it like this:

IN (SELECT VALUE FROM TABLE(SPLIT_TO_TABLE(MY_INPUT, ',')))

Upvotes: 1

Related Questions