我期待这个查询的结果
select cursor (select *
from Dba_Source
where Owner = 'ORD'
and Upper(Text) Like ob)
from (select '''%' || object_name || '%''' ob
from dba_objects
where owner = 'ORD'
and object_name = 'ORD_USERS');
由于ORD
架构中的某个存储过程使用了表ORD_USERS
。
有人可以让我知道什么是错的吗?
当我单独运行这些查询时,它们会返回
之类的结果select '''%' || object_name || '%''' ob
from dba_objects
where owner = 'ORD' and object_name = 'ORD_USERS';
'%ORD_USERS%'
select *
from Dba_Source
where Owner = 'ORD'
and Upper(Text) like '%ORD_USERS%';
Owner Name Type Line Text
----- -------- ------------- ----- ---------------
ORD ORD_PKG PACKAGE_BODY 126 FROM ORD_USERS,
答案 0 :(得分:0)
希望以下示例能够为您展示问题和解决方案:
with sample_data as (select 'fredbobgeorge' str from dual union all
select '''fredbobgeorge''' str from dual)
select 'with quoted like' search_type,
str
from sample_data
where str like (select '''%bob%''' from dual)
union all
select 'without quoted like' search_type,
str
from sample_data
where str like (select '%bob%' from dual);
SEARCH_TYPE STR
------------------- ---------------
with quoted like 'fredbobgeorge'
without quoted like fredbobgeorge
without quoted like 'fredbobgeorge'