如何检查数组是否包含特定字符串? [英] How to check if an array contains a particular string?
本文介绍了如何检查数组是否包含特定字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个字符串数组.我想检查数组中是否存在特定的字符串.
I have an array of strings. I want to check if a particular string is present in the array.
DECLARE
TYPE v_array IS TABLE OF VARCHAR2(200);
ais_array v_array;
BEGIN
ais_array := ('Lb1','Lb2','Lb3','Lb613');
IF 'Lb1' IN ais_array THEN
dbms_output.put_line('found');
END IF;
END;
IN
运算符不起作用.我尝试对类型执行select *
,然后使用IN
,但这也不起作用.
The IN
operator is not working. I tried doing a select *
on the type and then using IN
but that didn't work either.
有什么建议吗?
推荐答案
尝试member of
条件:
IF 'Lb1' member of ais_array THEN
dbms_output.put_line('found');
END IF;
Oracle引入了几个集合运算符,用于处理10g中的集合.请阅读文档以了解更多信息.
Oracle introduced several set operators for working with collections in 10g. Please read the documentation to learn more.
这篇关于如何检查数组是否包含特定字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文