Oracle 中使用IN 遇到的问题

本文探讨了一个在SQL查询中将复杂URL字符串转换为可匹配形式,并应用于实际查询场景的问题。通过实例展示了如何将自定义的URL转换逻辑整合到SQL语句中,以实现高效的数据匹配。同时,提出了一种替代方案来解决直接嵌入转换函数导致的查询失败问题,并通过实际案例验证了其可行性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我要查找一个集合,单独执行select  ''''||replace(Ztdoc,',',''',''')||'''' as urls from   sl_hot_sport t where t.Htype='164' and t.id=46,这句会得到'201509/11/121.png','201509/11/add.png','',
如果将这个结果放到语句select   e.title, e.fileurl from ss_feature_document e
where  e.fileurl in ('201509/11/121.png','201509/11/add.png',''),里是能得到数据的,但是如果这两句结合后。如下
就得不到数据了,
select   e.title, e.fileurl from ss_feature_document e
where  e.fileurl in (select  ''''||replace(Ztdoc,',',''',''')||'''' as urls from   sl_hot_sport t where t.Htype='164' and t.id=46)

不过后来论坛中有人帮助这样写,就行了


select   e.title, e.fileurl,t.ztitle from sl_hot_sport t left join  ss_feature_document e on t.id=e.itemid
where instr((select  ''''||replace(Ztdoc,',',''',''')||'''' as urls from   sl_hot_sport t where t.Htype='164' and t.id=46) , e.fileurl )  > 0 ;


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值