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. Linux php 中文乱码解决

    在ubuntu下php网页输出乱码,在不涉及数据库编码的情况下: 修改“/etc/php5/apache2/php.ini”将 default_charset = "iso-8859-1&q ...

  2. 光流算法:灰度恒常约束,LK算法,HS算法

    关于如何提高计算精度和增加搜索范围,见:http://www.cnblogs.com/dzyBK/p/4982420.html

  3. [kuangbin带你飞]专题九 连通图

        ID Origin Title   76 / 163 Problem A POJ 1236 Network of Schools   59 / 177 Problem B UVA 315 Ne ...

  4. JDialog窗体

    class MyJDialog extends JDialog{    public MyJDialog(JFrame frame){    super(frame,"第一个Dialog窗体 ...

  5. codeforce--Vasya and Petya's Game

    网址:http://codeforces.com/contest/576/problem/A A. Vasya and Petya's Game time limit per test 1 secon ...

  6. OC基础(27)

    单例设计模式 *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !import ...

  7. Android:Activity的跳转

    // 实际开发中常用的方法 Intent intent = new Intent(); intent.setClass(MainActivity.this, LoginActivity.class); ...

  8. MongoDB基本操作命令

    由于工作需要,笔者这两天使用了一下MongoDB.真的很不习惯!但是确实好用,命令比mysql和sqlserver简单很多.在这里整理一些MongoDB的基本操作命令分享出来. 客户端的安装就不说了, ...

  9. CA提供的身份认证配置弃用

    场景:从CA网站登录,在CA主页点击我们集成到CA的业务系统图标进行跳转,发现业务系统登录过身份(没cookies),身份认证自动使用 url,跳转到CA登录页,造成二次登录 [Authorize] ...

  10. centos 6.5 samba简单配置

    1.安装samba yum -y install samba  (我的显示已经安装啦!) 2.编辑samba的配置文件 vi /etc/samba/smb.conf 用 testparm查看我配置后的 ...