1

I have a trigger:

CREATE OR REPLACE TRIGGER Med_Allergy_Warning BEFORE INSERT ON Prescription FOR EACH ROW
BEGIN
    IF (Find_ADR(:NEW.Visit_ID, :NEW.Medication_ID) != 'GOOOO') THEN
        DBMS_OUTPUT.PUT_LINE('Medication ('||:NEW.Medication_ID||') May cause an allergic reaction… You are warned!');
    ELSE
        DBMS_OUTPUT.PUT_LINE('Medication ('||:NEW.Medication_ID||') was prescribed successfully!');
END IF;
END;/

That outputs a DBMS_OUTPUT.PUT_LINE whenever a user enters a prescription that may cause allergic reactions. However, the user creates the entry in APEX - is there anyway to create a region to show this DBMS_OUTPUT.PUT_LINE message on the same page?

1
  • Please, tell me this code won't get into any real medical application ! Commented Apr 15, 2015 at 14:19

1 Answer 1

3

In theory, you should be able to call DBMS_OUTPUT.GET_LINE to get the data in your APEX code and display that. However, building application functionality that depends on writing to DBMS_OUTPUT is a terrible approach. If you want to log information about potential allergic reactions, you really, really ought to log that to a table that your APEX application can then report on. Hoping that whatever application issues the INSERT has enabled DBMS_OUTPUT let alone allocated a large enough buffer for the output let alone happened to remember to read from the buffer and display that to a human is a really bad idea.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.