DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: One Small trigger run problem!

  1. #1
    Join Date
    Feb 2001
    Posts
    203
    This trigger created with out errors but it's giving me some runtime errors.
    When i exectued this trigger i am getting this message.
    ------------------
    ERROR at line 1:
    ORA-20001: This equipment OM1104 is out of cal

    ORA-06512 EMERALD.CALIBRATION_DEVICE_BEF_INS_ROW
    line 12

    ORA-04088: error during execution of trigger 'EMERALD.CALIBRATION_DEVICE_BEF_INS_ROW'
    -----------------------
    any suggestions will help me. Thanks.

    My Trigger Code.
    -------------------------

    CREATE OR REPLACE TRIGGER EMERALD.CALIBRATION_DEVICE_BEF_INS_ROW
    BEFORE INSERT
    ON EMERALD.CALIBRATION_DEVICE
    REFERENCING OLD AS OLD NEW AS NEW
    FOR EACH ROW
    BEGIN
    IF
    :NEW.EXTERNAL_SOURCE_FLAG ='Y' THEN
    :NEW.CAL_DUE_DATE := :NEW.CAL_DUE_DATE;
    ELSE
    SELECT CAL_DUE_DATE INTO :NEW.CAL_DUE_DATE
    FROM EQUIPMENT
    WHERE EQUIPMENT_ID = :NEW.EQUIPMENT_ID AND
    CAL_DUE_DATE >= (SELECT CALIBRATION_DATE
    FROM CALIBRATION
    WHERE SERVICE_ID = :NEW.SERVICE_ID);
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-20001,'This equipment
    '||:new.equipment_id||' is out of cal');
    END;
    sree

  2. #2
    Join Date
    Aug 2000
    Posts
    194
    Try running the ELSE part of the trigger with the Bind Variables replaced by the value,

    SELECT CAL_DUE_DATE FROM EQUIPMENT
    WHERE EQUIPMENT_ID = :NEW.EQUIPMENT_ID AND
    CAL_DUE_DATE >= (SELECT CALIBRATION_DATE
    FROM CALIBRATION
    WHERE SERVICE_ID = :NEW.SERVICE_ID ;


    It seems that the ELSE part is getting executed and RETURNs no data, which inturn caused the XCEPTION "NO_DTA_FOUND"

  3. #3
    Join Date
    Feb 2001
    Posts
    203
    I tried with the bind variables. If no_data_found then i want to raise the application error. But it's not working. It's runtime error. Thanks.
    sree

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width