问题
This code compiles, but in TOAD it won't show the "hi wo" output
CREATE OR REPLACE PROCEDURE AdelTest IS
tmpVar NUMBER;
BEGIN
DBMS_OUTPUT.ENABLE(100: in INTEGER);
DBMS_OUTPUT.PUT_LINE('hi wo');
tmpVar := 0;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
--consider logging error then r-raise
RAISE;
END AdelTest;
How do I show the output(similar to how println shoots to console in Java ) ?
回答1:
You need to enable DBMS Output. If working in the Editor right-click and choose DBMS Output off of the Desktop flyout menu. There's a button that is red if it's disabled. Click it and it will turn green. Then execute your code. Output will display there. If you are working outside of the Editor (in Schema Browser for instance) select DBMS Output off of the main Toad View menu. Enable your output there. Output will display in that window.
回答2:
You can also view server output if for some reason DBMS output window is not getting enable. use QSR
editor embedded within toad for oracle edition..
How to use
- select the code in place
- Editor > Execute
SQL
viaQSR
have the set serveroutput
on as first statement in QSR window and run..
now it will show output in window..
Hope it helps!!!
来源:https://stackoverflow.com/questions/24959889/how-to-get-my-put-line-statement-to-display-in-toad