抱歉这个愚蠢的问题。我被dbms\U输出困住了:
首先,我在batch/sqlplus调用中尝试了它。但是spool文件将只包含消息“pl/sql successfully executed”(见第一部分代码)
我正在oracle database 12c enterprise edition release 12.1.0.2.0上运行代码
Spool D:\log\spool.txt
Declare
Some_Num Number := 5;
Begin
Dbms_Output.Enable(1000000);
Dbms_Output.Put_Line('Id, Timestamp');
For Rec In
(
Select 1 As Id, Sysdate As Timestamp From Dual
Union
Select 2 As Id, Sysdate As Timestamp From Dual
Union
Select 3 As Id, Sysdate As Timestamp From Dual
Union
Select 4 As Id, Sysdate As Timestamp From Dual
)
Loop
Dbms_Output.Put_Line( Rec.Id || ', ' || Rec.Timestamp );
-- some code here was actually executed;
End Loop;
--Dbms_Output.Disable;
Exception
When Others Then
Null;
Dbms_Output.Put_Line('Error');
--Dbms_Output.Disable;
End;
/
Spool Off
exit;
1条答案
按热度按时间gcmastyq1#
我自己找到的。我需要补充一下
在剧本的开头。