簡體   English   中英

oracle regexp_like與選擇模式

[英]oracle regexp_like with pattern from select

我嘗試使用正則表達式從表中選擇行。 模式是選擇的結果。
我在使用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;

我不明白為什么要使用in子句...

最后,解決方案是:

declare

  pattern varchar2;

begin

  select columns
  into pattern
  from table a
  where conditions;


  execute immediate '
      select col2 
      from table2 
      where regexp_like(column, :pattern)
  ' using pattern;

end;

謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM