Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

division by zero postgres

-- avoid division error in Postgres
value/NULLIF(col, 0)  -- if col == 0, NULL will be returned
value/COALESCE(NULLIF(col, 0), 1)  -- if col == 0, value will be returned 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #division #postgres
ADD COMMENT
Topic
Name
7+5 =