The Case-When-Exists expression in Oracle is really handy. Here's an example of how to use it in a sub-select to return a status. This SQL checks for a match between the PS_PERSON and PSOPRDEFN records to determine the person status. The idea is that if the operator is not inPS_PERSON then they are not a true person in PeopleSoft.

Please be aware that this SQL will only work if:

  • You are using PeopleSoft HRMS/CS 8.9 or above
  • You are using an Oracle database
 from PS_PERSON P where P.EMPLID = O.EMPLID ) then 'Person' else 'Not a Person' end as PERSON_STATUSfrom PSOPRDEFN O;

Case When Exists SQL的更多相关文章

  1. 使用CASE表达式替代SQL Server中的动态SQL

    原文:使用CASE表达式替代SQL Server中的动态SQL 翻译自: http://www.mssqltips.com/sqlservertip/1455/using-the-case-expre ...

  2. oracle case when exists()

    用法如下: select case when exists(select 1 from t_test c where c.name = 'zhangsan'     and c.age = 23 ) ...

  3. sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP 'users_ibfk_1'; check that column/key exists") [SQL: ALTER TABLE users DROP FOREIGN KEY users_ibfk_1]

    flask 迁移数据库报错 报错: sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP ...

  4. oracle case where 复杂sql语句

    update hr_user u set u.is_approve=(case when u.curr_org_id in (select t.org_id from hr_organization ...

  5. case when in sql server's stored procedure

    https://docs.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql Evaluates a list of c ...

  6. 一个 关于 case when的SQL

    [例]从stud_grade表中查询所有同学考试成绩情况,凡成绩为空者输出“未考”.小于60分输出“不及格”.60分至70分输出“及格”.70分至90分输出“良好”.大于或等于90分时输出“优秀”. ...

  7. 通过case when实现SQL 多个字段合并为一列值

    with tt as (select A.GID, CASE WHEN A.IsApp='是' THEN 'APP' else '' end 'APP', CASE WHEN A.IsSmallApp ...

  8. 你真的会玩SQL吗?Case也疯狂

    你真的会玩SQL吗?系列目录 你真的会玩SQL吗?之逻辑查询处理阶段 你真的会玩SQL吗?和平大使 内连接.外连接 你真的会玩SQL吗?三范式.数据完整性 你真的会玩SQL吗?查询指定节点及其所有父节 ...

  9. 转-sql中的case when的用法

    Case具有两种格式.简单Case函数和Case搜索函数. --简单Case函数 CASE sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE '其他' END ...

随机推荐

  1. EF中使用SQL语句或存储过程

    EF中使用SQL语句或存储过程 1.无参数查询var model = db.Database.SqlQuery<UserInfo>("select* from UserInfoe ...

  2. feedback 是什么意思

    feedback 是什么意思 能否不要说 feedback 呢?  加一个 feedback?  天啊   先解释一下 feedback 是什么  ? 还有   aria-describedby=&q ...

  3. java记录在线人数小案例

    文件目录: web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...

  4. mfc 数据库显示到editcontrol控件问题

    http://bbs.csdn.net/topics/390601634 CString CMyDB::VariantToString(const _variant_t &var) {     ...

  5. hitTest方法与PointInside方法

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  6. OS X 升级 Yosemite 后,Intellij IDEA 与 VirtualBox 启动失败

    报错: Dyld Error Message: Symbol not found: _CGContextSetAllowsAcceleration Referenced from: /Library/ ...

  7. jdk线程的死锁

    两个线程相互等着对方释放同步监听器:等着要对方的结果后才能继续执行就会发生死锁. 男对女说:你先嫁给我,我再给你买房子:女对男说:你先给我买房子,我再嫁给你. 多个线程同时锁住同一个监听对象. 在开发 ...

  8. Windows 7(x64)下安装Ubuntu12.4

    对于想安装双系统,但是U盘无法引导安装Ubuntu的,下面的办法是很有效的. 〇.BIOS设置 启动选择:Legacy 一.使用U大师分区 U大师U盘装系统Win03pe工具箱V2.1 磁盘分配情况( ...

  9. 实验比较python中的range和xrange

    1 结论: 全用xrange,除非你需要使用返回的列表 2 实验一:性能对比 实验环境:win7 ,64位系统 python2.7 import time StartTime=time.time() ...

  10. Start:at cnblogs firstDay

    C#旨在设计成为一种"简单.现代.通用",以及面向对象的程序设计语言,此种语言的实现,应提供对于以下软件工程要素的支持:强类型检查.数组维度检查.未初始化的变量引用检测.自动垃圾收 ...