Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TO_NUMBER - functionality in Trigger

524171Jul 20 2006 — edited Jul 20 2006
hi,
i have problems creating a Trigger that uses the TO_NUMBER-function.
There's a Field VK_PREIS (nvarchar2) filled with prices from products.
because not all values in this field are numeric (e.g. "N.A." ) , i want to copy the numeric value to VK_PREIS_NUM (Number) by a trigger :
CREATE OR REPLACE TRIGGER "TR_KALENDER_PREIS"

BEFORE INSERT OR UPDATE ON "KALENDER"

FOR EACH ROW

BEGIN

:NEW.VK_PREIS_NUM := TO_NUMBER(DECODE(LENGTH(TRIM(TRANSLATE(trim(:NEW.VK_PREIS), ' +-.,0123456789',' '))), NULL, REPLACE(:NEW.VK_PREIS, '.', ','), '0'));

END;

but every time i update a dataset, the trigger throws an exception "("VDI"."TR_KALENDER_PREIS" is invalid and failed re-validation"

if i just copy the value ( :NEW.VK_PREIS_NUM := :NEW.VK_PREIS; ) i get no error.

any ideas?

(sorry for my bad english)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2006
Added on Jul 20 2006
5 comments
620 views