gpt4 book ai didi

sql - SAS 中的 Oracle NVL 等效项

转载 作者:行者123 更新时间:2023-12-05 01:11:02 25 4
gpt4 key购买 nike

我需要将sql代码转换为sas代码;

  NVL(SPRTELE_STATUS_IND, 'A') = 'A' 
AND NVL(SPRTELE_PRIMARY_IND, 'Y') = 'Y'
AND NVL(SPRTELE_SEQNO, 99) =

(SELECT NVL(MAX(SPRTELE_SEQNO), 99)
FROM SATURN.SPRTELE D
WHERE SPRIDEN_PIDM = D.SPRTELE_PIDM
AND D.SPRTELE_TELE_CODE = 'MA'
AND NVL(D.SPRTELE_STATUS_IND, 'A') = 'A'
AND NVL(D.SPRTELE_PRIMARY_IND, 'Y') = 'Y'))

如何将 NVL 转换为 sas?那什么意识

最佳答案

使用正确的函数代替 NVL()COALESCE() .这是 ANSI 标准函数,受 SAS、Oracle 和大多数其他数据库支持:

  COALESCE(SPRTELE_STATUS_IND, 'A') = 'A' 
AND COALESCE(SPRTELE_PRIMARY_IND, 'Y') = 'Y'
AND COALESCE(SPRTELE_SEQNO, 99) =

(SELECT COALESCE(MAX(SPRTELE_SEQNO), 99)
FROM SATURN.SPRTELE D
WHERE SPRIDEN_PIDM = D.SPRTELE_PIDM
AND D.SPRTELE_TELE_CODE = 'MA'
AND COALESCE(D.SPRTELE_STATUS_IND, 'A') = 'A'
AND COALESCE(D.SPRTELE_PRIMARY_IND, 'Y') = 'Y'))

完整查询中可能存在其他差异。

关于sql - SAS 中的 Oracle NVL 等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24186204/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com