Ask the Expert

"Divisor is equal to zero" error

I am getting an "ORA-01476: divisor is equal to zero" error on a insert statement that does no dividing. Can you tell me why?
insert into ps_cm_perpadj_tmp (business_unit , inv_item_id , cm_dt_timestamp_p , 
cm_seq_nbr_p , cm_unit_cost_old , cm_unit_cost_povo , CM_UNIT_COST_VO , 
QTY_BASE , QTY_OWNED , CM_ADJUST_QTY , CM_WRITEOFF_QTY , CM_UNIT_COST , 
CURRENCY_CD) SELECT A.BUSINESS_UNIT , A.INV_ITEM_ID , A.CM_DT_TIMESTAMP_P , 
A.CM_SEQ_NBR_P , C.CM_UNIT_COST , A.CM_UNIT_COST_POVO , A.CM_UNIT_COST_VO , 
A.QTY_BASE , B.QTY_OWNED , 0 , 0 , 0 , D.BASE_CURRENCY FROM 
PS_CM_PERPAVGS_VW A , PS_BU_ITEMS_INV B , PS_CM_PERPCUR_VW C , 
PS_BUS_UNIT_TBL_IN D WHERE A.BUSINESS_UNIT = B.BUSINESS_UNIT 
AND A.INV_ITEM_ID = B.INV_ITEM_ID AND A.BUSINESS_UNIT = C.BUSINESS_UNIT 
AND A.INV_ITEM_ID = C.INV_ITEM_ID AND A.BUSINESS_UNIT = D.BUSINESS_UNIT 
AND A.BUSINESS_UNIT = :1

    Requires Free Membership to View

As can be seen by your INSERT statement, there is no division. So there are now two places to look. First, your INSERT statement is performing a SELECT statement. This SELECT statement has three components to the FROM clause. If one of those components is a view, it is possible that the view is performing an illegal division operation, hence the error. Or the view could be calling a function which is performing the division. Second, your table could have a trigger on it which is performing division. Check any views or triggers involved in the operation.

This was first published in July 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: