在Oracle Apex中显示触发器DBMS_OUTPUT.PUT_LINE [英] Showing Trigger DBMS_OUTPUT.PUT_LINE in Oracle Apex
问题描述
我有一个触发器:
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;/
每当用户输入可能引起过敏反应的处方时,就会输出DBMS_OUTPUT.PUT_LINE.但是,用户在APEX中创建条目-是否仍然要创建一个区域以在同一页面上显示此DBMS_OUTPUT.PUT_LINE消息?
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?
推荐答案
从理论上讲,您应该能够调用 DBMS_OUTPUT.GET_LINE
来获取APEX代码中的数据并进行显示.但是,构建依赖于写入 DBMS_OUTPUT
的应用程序功能是一种糟糕的方法.如果您想记录有关潜在过敏反应的信息,您确实应该将其记录到APEX应用程序可以报告的表中.希望无论应用程序发出什么 INSERT
都已启用 DBMS_OUTPUT
,更不用说为输出分配了足够大的缓冲区,更不用说记得记住从缓冲区读取并将其显示给人类了是一个非常糟糕的主意.
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.
这篇关于在Oracle Apex中显示触发器DBMS_OUTPUT.PUT_LINE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!