We get the divide by zero error if the denominator in the division is zero. We can avoid by using the NULLIF function as below select 100/ nullif(0,0) from dual; Now here since both the values are equal ,Nullif will return null and whole expression will return null instead of any error. Here is how you can use when dealing with real column select col2/ nullif(col1,0) from exp;