I'm about to migrate queries from Legacy to Standard in BQ.
In Legacy I used to have x/y
returning null
if y=0
, however, I'm stuck in StandardSQL with the error:
Error: division by zero
I'd like to apply something like IFERROR(x/y,null)
Is it available in StandardSQL?
In standard SQL you can use SAFE_DIVIDE(x, y)
It is an equivalent to the division operator (/). Returns NULL if an error occurs, such as division by zero.