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. 名词解释:DRAM, SRAM, SDRAM等

    SRAM:静态RAM,不用刷新,速度可以非常快,像CPU内部的cache,都是静态RAM,缺点是一个内存单元需要的晶体管数量多,因而价格昂贵,容量不大. DRAM:动态RAM,需要刷新,容量大. SD ...

  2. C++开源hash项目sparsehash

    源码地址: https://github.com/sparsehash/sparsehash

  3. 把Nginx加为系统服务(service nginx start/stop/restart)

    1.编写脚本,名为nginx #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - ...

  4. Linux自启动

    linux 下tomcat开机自启动修改Tomcat/bin/startup.sh 为:export JAVA_HOME=/usr/java/j2sdk1.4.2_08export CLASSPATH ...

  5. Java SE 第九讲---面向对象特征之封装1

    1.面向对象程序设计的三大基本特征:继承(Inheritence).封装(Encapsulation).多态(Polymorphism) 2.封装:类包含数据与方法,将数据与方法放在一个类中就构成了封 ...

  6. Ext 4.2 RowEditing

    Follow: function () { Ext.define('Follow', { extend: 'Ext.data.Model', idProperty: 'id', fields: [ { ...

  7. Eclipse 常用设置

    1. eclipse中的汉字横着显示怎么解决 同一种字体有两种显示方式,比如Fixedsys Excelsior 3.01和@Fixedsys Excelsior 3.01,前一种汉字是竖着显示,后一 ...

  8. ios7 Cocos2dx 隐藏状态栏设置

    环境: cocos2d-x 2.1.5 ios7.0     在info.plist 添加 UIViewControllerBasedStatusBarAppearance(View controll ...

  9. Oracle GoldenGate 11.2 OGG-01168(转)

    为客户部署的Oracle GoldenGate在测试阶段出现如下的错误: 2012-04-24 10:45:20  ERROR   OGG-01168  Oracle GoldenGate Deliv ...

  10. NEERC 2013, Eastern subregional contest

    I. The old Padawan Time limit: 0.5 secondMemory limit: 64 MB Yoda: Use the Force. Yes. Now, the ston ...