SQL / SQR Oracle交叉检查表的列

时间:2016-10-27 16:47:52

标签: sql oracle sqr

基本上,我正在编写一个SQL(将转换为SQR),只要员工与其中一个销售团队相关的状态发生变化,就会创建报告。我现在遇到的问题是,如果一名员工转出一个相关部门,我需要将其作为报告的一部分,这意味着我需要与DEPTID和LASTUPDDTTM交叉检查EMPLID,看看他们是否首先来自销售,这是我正在尝试的想法:

If $ACTION = 'XFR'
    EVALUATE $DEPTID
        WHEN ='0111'
                WHEN ='0222'
                WHEN ='0444'
                WHEN ='0333'
                WHEN ='0555'
        LET $ACTION_DESCR =('Transfer-In')
            do Write-Line
        !WHEN -OTHER (check syntax)
        !Do CheckTransferOut
    END-EVALUATE


 ELSE
    EVALUATE $ACTION
        WHEN ='ADD'
        WHEN ='HIR'
        WHEN ='POS'
        WHEN ='PRO'
        WHEN ='REH'
        WHEN ='RET'
        WHEN ='TER'
        WHEN ='TWB'
        WHEN ='TWP'
            EVALUATE $DEPTID
                WHEN ='0111'
                WHEN ='0222'
                WHEN ='0444'
                WHEN ='0333'
                WHEN ='0555'
                    do Write-Line
            END-EVALUATE
    END-EVALUATE

END-IF

0 个答案:

没有答案