nvl配置单元中的子查询

hfyxw5xn  于 2021-06-24  发布在  Hive
关注(0)|答案(0)|浏览(279)

所以我必须将数据从oracle传输到hive。我的问题是在nvl中有nvl和另外两个子查询。

SELECT CCODE,
    E_DATE,
    E_HOUR,
    E_MINUTE,
    EXPI_DATE,
    MR_RATE,
    CMAR
FROM
  (SELECT CCODE,
    E_DATE,

 NVL(
    (SELECT MIN(DATE_TIME)AS E_DATE 
        FROM (SELECT CURR_H_C,
                    SEQUENCE,
                    DATE_TIME 
                        FROM (SELECT CURR_H_C,
                                SEQUENCE,
                                DATE_TIME,
                                    CASE
                                        WHEN lead(ed) over (partition BY CURR_H_C order by ed) IS NULL
                                        THEN 'Y'
                                        ELSE 'N'
                                        END flag
                                FROM table_one
                             WHERE SEQUENCE = '1')
                WHERE flag = 'Y') Z
     WHERE REGEXP_SUBSTR (CURR_H_C, '[^;]+', 1, 1) = A.CCODE
     AND Z.DATE_TIME                                        > A.DATE_TIME
    ),

    (SELECT MIN(DATE_TIME)AS E_DATE
        FROM (SELECT CRCY_CODE,
                    SEQUENCE,
                    DATE_TIME 
                    FROM(SELECT CRCY_CODE,
                            SEQUENCE,
                            DATE_TIME,
                                CASE
                                    WHEN lead(ed) over (partition BY CRCY_CODE order by ed) IS NULL
                                    THEN 'Y'
                                    ELSE 'N'
                                    END flag
                            FROM table_two
                            WHERE SEQUENCE = '1')
                            WHERE flag = 'Y') Z
                                WHERE CRCY_CODE = A.CCODE
                                AND Z.DATE_TIME     > A.DATE_TIME
                                )
                                 )AS EXPI_DATE,

                                M.MR_RATE,

如何在Hive上翻译?我已经尝试了ifnull()和其他方法。
任何帮助/建议都将不胜感激!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题