0

I am trying to create a UDF2 in JavaScript language which returns set of query statements as a String based on the input we pass. Here , this String value should be appended to the where clause as SQL Text in UDF1 defined in SQL language.

for example : WHERE condition1 AND condition2 AND ( DB.SCHEMA.UDF2(PARM_1) -- This UDF2 returns a query set in String type. Now its checking as a Boolean condition in UDF1 but I want it to be concatenated as a SQL query to the existing where clause )

Please suggest me any approach to achieve this in Snowflake.

Thanks in Advance !

  • What have you tried so far? Do you have any code example of what you've already tried? – Sergiu Nov 25 '21 at 12:15
  • Two small sample before and after tables would help understand the requirement too. – Greg Pavlik Nov 25 '21 at 12:28
  • I created an UDF in JavaScript to return some statements based on the input parameter. When I am calling this UDF in main function which is defined in SQL language , I am getting an error ,Boolean value is not recognized since the return value of 2nd UDF is a String . What I needed here is that returned String should be changed to executable SQL Text and should append to the part above in main function where this UDF is called. – Mounika Nov 25 '21 at 13:01
  • The return statement of the UDF should act as a filter in where condition in the main function. – Mounika Nov 25 '21 at 13:09

0 Answers0