hiveavro调用字段刚刚写好

aij0ehis  于 2021-06-01  发布在  Hadoop
关注(0)|答案(1)|浏览(339)

我正在使用配置单元并试图向一个表中写入数据,我想知道是否有可能调用我刚刚写入的一个字段,以便创建另一个字段变量。

Case When Substr(Upper(Trim(MBRCHR)),-3) rlike '[8-9][0-9][A-E]'
    Then
        Substr(Upper(trim(regexp_replace(MBRCHR,'[^0-9]',''))),1,Length(Upper(Trim(regexp_replace(MBRCHR,'[^0-9]',''))))-2)
    Else
        Upper(trim(regexp_replace(MBRCHR,'[^0-9]+','')))
    End as MBR_DRVD,
Case when Length(MBR_DRVD) between 7 and 9
    Then*****use this to derive the new field.

我试过这样写,但是因为mbr\u drvd不在我填充当前表的表中,所以它出错了。
如有任何建议,将不胜感激。

bgtovc5b

bgtovc5b1#

不可能直接执行,可以使用子查询,如

select ....
Case when Length(MBR_DRVD) between 7 and 9
        Then*****use this to derive the new field.
from (
select 
Case When Substr(Upper(Trim(MBRCHR)),-3) rlike '[8-9][0-9][A-E]'
    Then
        Substr(Upper(trim(regexp_replace(MBRCHR,'[^0-9]',''))),1,Length(Upper(Trim(regexp_replace(MBRCHR,'[^0-9]',''))))-2)
    Else
        Upper(trim(regexp_replace(MBRCHR,'[^0-9]+','')))
    End as MBR_DRVD,
...
from yourtable
) t;

相关问题