You can translate the question and the replies:

Multiple Union statements with parameters are not working in VQL.

Hi There, We are trying to implement multi UNION. It is something like following: `CREATE VIEW iv_union_test as SELECT * FROM iv_derived_vw q1 WHERE q1.date = i_date AND q1.id = i_id AND q1.flg = 0 UNION SELECT * FROM iv_derived_vw q2 WHERE q2.date = i_date AND q2.id = i_id AND q2.flg = 1 UNION SELECT * FROM iv_derived_vw q3 WHERE q3.date = i_date AND q3.id = i_id AND q3.flg = 2 USING PARAMETERS ( i_date : TEXT , I_ID : LONG ) ` But this is not working and throwing up an error. Please find error below. While we hard code the parameters and avoid "USING PARAMETERS ( i_date : TEXT , I_ID : LONG ) " statement. I am able to successfully create a derived view. We need help here. **Error calculating view: Error in select view conditions: Field not found 'iv_derived_vw.i_id' in view 'iv_derived_vw'**
user
31-07-2020 16:31:11 -0400

1 Answer

Hi, The error message “Error in select view conditions: Field not found ‘iv_derived_vw.i_id’ in view ‘iv_derived_vw’” occurred because the field i_id defined iv_derived_vw is not found. In general, if the view parameter does not have a default value, then the Virtual DataPort would generate a union query by providing the obligatory field with each of the possible values. But when there is a default value, the view parameter becomes not OBL, so a union is not generated. For more information, you can have a look at the document [Creating Union Views](https://community.denodo.com/docs/html/browse/7.0/vdp/administration/creating_derived_views/creating_union_views/creating_union_views#creating-union-views) and [Parameters of Derived Views](https://community.denodo.com/docs/html/browse/7.0/vdp/administration/creating_derived_views/creating_selection_views/creating_selection_views#parameters-of-derived-views) of the Virtual DataPort Administration Guide. Hope this helps!
Denodo Team
03-08-2020 08:29:36 -0400
You must sign in to add an answer. If you do not have an account, you can register here