【发布时间】:2013-07-05 09:32:18
【问题描述】:
我尝试使用正则表达式从表中选择行。模式是选择的结果。
我在使用 regexp_like 的选择上出现以下编译错误:
PLS-00428:此 SELECT 语句中应有一个 INTO 子句
declare
pattern varchar2;
begin
select columns
into pattern
from table a
where conditions;
select *
from table2
where regexp_like(column, pattern);
end;
我不明白为什么要使用 into 子句...
【问题讨论】:
-
plsql 中的 SELECT 应该有一个 INTO 子句。您已经在第一条语句中使用了它。
-
您的语句“select * from table2 where regexp_like(column, pattern);”也应该像第一个一样有一个 INTO 子句。为什么你仍然需要这个声明?你在任何地方使用第二个选择语句的 o/p 吗?
-
我将使用第二个选择:update my_table set col = value where col2 in (select * from table2 where regexp_like(column, pattern))
-
如果你打算使用没有INTO子句的普通sql语句,那么你可以简单地使用execute('sql statement')或execute immediate('sql statement');
-
table2 中只有一列? 'where col2 in (select col2..)' 应该是这样的