sql - 从 oracle 表中过滤无效 id
问题描述
我的桌子
NAME
Peter
Lance
Oscar
Steve
Reddy
我的查询的输入是字符串数组,比方说Peter, Bond, Steve, Smith
我的查询应该返回我输入的无效值(即)Bond & Smith
我正在使用Oracle 12.1.0
并且不支持 odcivarchar2list。
任何建议将不胜感激
解决方案
您可以使用cte
:
with list_string as (
select 'Peter' as name union all
select 'Bond' as name union all
select 'Steve' as name union all
select 'Smith' as name
)
select ls.name, 'Invalid Values'
from list_string ls
where not exists (select 1 from table t1 where t1.name = t.name);
推荐阅读
- git - 了解如何压缩提交
- java - 向 JSP 公开 Spring 组件
- intellij-idea - SBT 无法读取 IntelliJ 中的环境变量
- vue.js - 如何让 v-data-table 在 vuetify 中为 - 和 + 呈现图标?
- java - 找不到 activemq.xml 的 Spring NamespaceHandler
- c# - 当不断有多个呼叫者等待进入时,SemaphoreSlim 是否保证进入
- python - Python 请求登录后失败,页面已过期
- excel - VSTO ListObject 重命名事件
- android - 如何为日期键的 json 映射创建 gson 格式?
- javascript - 使用 VBA 脚本登录网站登录页面