Variables 如何在批处理文件的日志文件中显示PL/SQL块中使用的变量的值?阵列呢?
基本上,我使用批处理文件在Windows任务调度器上运行.sql文件。批处理文件生成一个日志文件,其中显示所有put_行。我现在还想查看分配给变量的值:v\u chks\u dm,但无法找到一种方法。尝试了get_line语句,但失败。。。有人知道怎么做吗? 谢谢 这是批处理文件中的内容:Variables 如何在批处理文件的日志文件中显示PL/SQL块中使用的变量的值?阵列呢?,variables,batch-file,plsql,getline,Variables,Batch File,Plsql,Getline,基本上,我使用批处理文件在Windows任务调度器上运行.sql文件。批处理文件生成一个日志文件,其中显示所有put_行。我现在还想查看分配给变量的值:v\u chks\u dm,但无法找到一种方法。尝试了get_line语句,但失败。。。有人知道怎么做吗? 谢谢 这是批处理文件中的内容: echo off echo ****************************>>C:\output.log sqlplus userid/password@csdpro @V:\COND
echo off
echo ****************************>>C:\output.log
sqlplus userid/password@csdpro @V:\CONDITION_TEST.sql>>C:\output.log
这是.sql文件
declare
v_chks_dm number;
begin
Select /*+parallel (a,4)*/ count(distinct a.src_table) into v_chks_dm
from hcr_dm.hcr_dm_fact a;
dbms_output.put_line('v_chkt_dm value assigned');
-- dbms_output.get_line(v_chks_dm);
if.... then... else.... end if;
end;
还有一个问题。。。如果变量是数组呢?我有类似的东西,但有一个错误说ORA-06533:下标超过计数。数组中的值的数量通常从0到10不等,但可能更多。谢谢
declare
type v_chks_array is varray(10) of varchar2(50);
arrSRCs v_chks_array;
begin
arrSRCs :=v_chks_array();
arrSRCs.EXTEND(10);
Select /*+parallel (a,4)*/ distinct a.src_table BULK collect into arrSRCs
from hcr_dm.hcr_dm_fact a;
dbms_output.put_line(arrSRCs(10));
end;
或者更好
dbms_output.put_line('v_chkt_dm value = ' || to_char(v_chkt_dm, '<number format>'));
dbms_output.put_line('v_chkt_dm value='| to_char(v_chkt_dm,');
您可以在中选择适当的数字格式。这很容易。。。谢谢嗯,您还应该了解函数lpad和rpad,我预测接下来您将要使用:))您可以使用lpad和rpad函数格式化文本输出。
dbms_output.put_line('v_chkt_dm value = ' || to_char(v_chkt_dm, '<number format>'));