BigQuery - 标准 SQL 的 IFERROR

BigQuery - IFERROR for standardSQL

我即将在 BQ 中将查询从旧版迁移到标准版。 在 Legacy 中,如果 y=0,我曾经 x/y 返回 null,但是,我被困在 StandardSQL 中并出现错误:

Error: division by zero

我想申请 IFERROR(x/y,null)

它在 StandardSQL 中可用吗?

在标准 SQL 中,您可以使用 SAFE_DIVIDE(x, y)
它等同于除法运算符 (/)。 Returns 如果出现错误,如被零除,则为 NULL。