ORACLE # IF..THEN.. 在输出中获取代码

ORACLE # IF..THEN.. GETTING CODE IN OUTPUT

在执行下面的程序时,如果我得到了想要的结果,但我的代码也出现在 sql 开发人员的输出 Window 中。如何避免代码出现在我的输出中?

你能解释一下我做错了什么吗?

Accept Num Prompt ' Please Enter Number between 0-9';
Declare
NUM number := #
BEGIN

IF Num = 0 Then 
Dbms_Output.put_line('You have Entered Zer0');
ELSIF NUM =1 Then 
Dbms_Output.put_line('You have Entered one'); 
ELSIF NUM =2 Then
Dbms_Output.put_line('You have Entered TWO'); 
ELSIF NUM =3 Then
Dbms_Output.put_line('You have Entered THREE'); 
ELSIF NUM =4 Then
Dbms_Output.put_line('You have Entered FOUR'); 
ELSIF NUM =5 Then
Dbms_Output.put_line('You have Entered FIVE'); 
ELSIF NUM =6 Then
Dbms_Output.put_line('You have Entered SIX'); 
ELSIF NUM =7 Then
Dbms_Output.put_line('You have Entered SEVEN');
ELSIF NUM =8 Then
Dbms_Output.put_line('You have Entered EIGHT'); 
ELSIF NUM =9 Then
Dbms_Output.put_line('You have Entered NINE');
ELSE
Dbms_Output.put_line('You have Entered more than single digit');
END IF;
END;

SQL 开发人员的输出:

old:Declare
NUM number := #
BEGIN

IF Num = 0 Then 
Dbms_Output.put_line('You have Entered Zer0');
ELSIF NUM =1 Then 
Dbms_Output.put_line('You have Entered one'); 
ELSIF NUM =2 Then
Dbms_Output.put_line('You have Entered TWO'); 
ELSIF NUM =3 Then
Dbms_Output.put_line('You have Entered THREE'); 
ELSIF NUM =4 Then
Dbms_Output.put_line('You have Entered FOUR');  
ELSIF NUM =5 Then
Dbms_Output.put_line('You have Entered FIVE'); 
ELSIF NUM =6 Then
Dbms_Output.put_line('You have Entered SIX'); 
ELSIF NUM =7 Then
Dbms_Output.put_line('You have Entered SEVEN');
ELSIF NUM =8 Then
Dbms_Output.put_line('You have Entered EIGHT'); 
ELSIF NUM =9 Then
Dbms_Output.put_line('You have Entered NINE');
ELSE
Dbms_Output.put_line('You have Entered more than single digit');
END IF;
END;
new:Declare
NUM number := 0;
BEGIN

IF Num = 0 Then 
Dbms_Output.put_line('You have Entered Zer0');
ELSIF NUM =1 Then 
Dbms_Output.put_line('You have Entered one'); 
ELSIF NUM =2 Then
Dbms_Output.put_line('You have Entered TWO'); 
ELSIF NUM =3 Then
Dbms_Output.put_line('You have Entered THREE'); 
ELSIF NUM =4 Then
Dbms_Output.put_line('You have Entered FOUR'); 
ELSIF NUM =5 Then
Dbms_Output.put_line('You have Entered FIVE'); 
ELSIF NUM =6 Then
Dbms_Output.put_line('You have Entered SIX'); 
ELSIF NUM =7 Then
Dbms_Output.put_line('You have Entered SEVEN');
ELSIF NUM =8 Then
Dbms_Output.put_line('You have Entered EIGHT'); 
ELSIF NUM =9 Then
Dbms_Output.put_line('You have Entered NINE');
ELSE
Dbms_Output.put_line('You have Entered more than single digit');
END IF;
END;
anonymous block completed
You have Entered Zer0

将此行添加到脚本的顶部:

SET VERIFY OFF

默认情况下,VERIFYON 并导致 SQL*Plus(和 SQL Developer)在替换替换变量之前和之后显示代码。将其设置为 OFF 可禁用此行为。