## Blog

# ORA-01476: divisor is equal to zero

- November 11, 2021
- Posted by: admin
- Category: Oracle DBA

No Comments

## ORA-01476: divisor is equal to zero

2 SELECT 1 DIVIDEND, 0 DIVISOR FROM DUAL

3 )

4 SELECT DIVIDEND/DIVISOR AS QUOTIENT FROM T;

SELECT DIVIDEND/DIVISOR AS QUOTIENT FROM T

*

ERROR at line 4:

ORA-01476: divisor is equal to zero

### 1. Case When Then

#### Here we simply return NULL is DIVISOR is ZERO, otherwise we divide.

### 2. NULLIF(expr1, expr2)

#### I prefer this over CASE WHEN THEN approach

**NULLIF **compares expr1 and expr2. If they are equal, then the function returns NULL. If they are not equal, then the function returns EXPR1. In Oracle Database any mathematical operation involving NULL is evaluated to NULL - DIVIDEND/NULL = NULL

## ORA-01476: divisor is equal to zero

2 SELECT 1 DIVIDEND, 0 DIVISOR FROM DUAL

3 )

4 SELECT DIVIDEND/DIVISOR AS QUOTIENT FROM T;

SELECT DIVIDEND/DIVISOR AS QUOTIENT FROM T

*

ERROR at line 4:

ORA-01476: divisor is equal to zero