简体   繁体   English

AWS Athena 中是否有相当于 Oracle 的“双重”表?

[英]Is there an equivalent to Oracle's `dual` table in AWS Athena?

I typically use Oracle's dual table to test functions that I have never used before prior to incorporating them in other queries.我通常使用 Oracle 的dual表来测试我以前从未使用过的函数,然后再将它们合并到其他查询中。 I was wondering if there is an equivalent dummy table in AWS Athena.我想知道 AWS Athena 中是否有等效的虚拟表。

For example, I have never used Athena's date_parse function.例如,我从未使用过 Athena 的date_parse function。 In Oracle, I would do the following to test if the function works as expected:在 Oracle 中,我将执行以下操作来测试 function 是否按预期工作:

select
    date_parse('2021-05-18', '%Y-%m-%d') as does_it_work
from
    dual
;

dual should not be needed.不应该需要dual You can just do:你可以这样做:

select date_parse('2021-05-18', '%Y-%m-%d') as does_it_work

Or if you really like dual , you can do:或者如果你真的喜欢dual ,你可以这样做:

with dual as (
      select 1 as dummy
     )
select date_parse('2021-05-18', '%Y-%m-%d') as does_it_work
from dual;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM