[英]SAP HANA SQL SCRIPT Select where in array
is there any possibility to use something like SELECT * FROM xy WHERE xy.field in :array;有没有可能使用像 SELECT * FROM xy WHERE xy.field in :array; 这样的东西? in SQL SCRIPT?在 SQL 脚本中? Im using Abap Managed Datebase Procedures我使用 Abap 托管数据库程序
DECLARE arr NVARCHAR(5) ARRAY;
IF i_where = ''
THEN arr = ARRAY ('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7' );
ELSE arr = ARRAY ( i_where );
END IF;
e_result = SELECT DISTINCT
...
WHERE sales.hierarchy in :arr
Thanks!谢谢!
Yes, you can use the [NOT] MEMBER OF function https://help.sap.com/saphelp_hanaplatform/helpdata/en/f6/66b950e5d34f84bb5b6f125e7e85c4/content.htm to check for matches within in an array.是的,您可以使用[NOT] 成员函数https://help.sap.com/saphelp_hanaplatform/helpdata/en/f6/66b950e5d34f84bb5b6f125e7e85c4/content.htm来检查数组中的匹配项。
If you want the array contents to be the filter for a column, then you first need to UNNEST it.如果您希望数组内容成为列的过滤器,那么您首先需要对其进行 UNNEST。
name the unnest field.命名 unnest 字段。 tbl = UNNEST(:arr) as ("fieldname"); tbl = UNNEST(:arr) as ("fieldname"); Try ... WHERE sales.hierarchy IN ( selec "fieldname" from tbl )尝试... WHERE sales.hierarchy IN(从 tbl 中选择“fieldname”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.