You can translate the question and the replies:

dynamic parameters value in where condition

Hi team, Does denodo has the function to suport dynamic paramters input in where condition, e.g. where (case when parameter_flag = 'A' then date_column = baseview.date_col_a when parameter_flag = 'B' then date_column = baseview.date_col_b else '19000101 end)
user
24-06-2023 04:41:32 -0400
code

1 Answer

Hi, If I understand correctly, you would like to be able to dynamically set the WHERE condition fields based on a parameter input. There are various ways you can implement this, and one of them is by using the [CASE clause](https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/queries_select_statement/case_clause/case_clause) in the WHERE part of the query. You can explore more on the different ways to use the CASE clause in the documentation [CASE Clause Examples](https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/appendix/case_clause_examples/case_clause_examples). For your sample code, you can update your syntax into like this: ``` WHERE date_column = ( CASE @parameter_flag WHEN 'A' then baseview.date_col_a WHEN 'B' then baseview.date_col_b ELSE '19000101’ END) ``` Hope this helps!
Denodo Team
26-06-2023 01:44:52 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here