How to display the value of a variable used in a PL/SQL block in the log file of a batch file? And Arrays? -
How to display the value of a variable used in a PL/SQL block in the log file of a batch file? And Arrays? -
basically i'm using batch file run .sql file on windows task scheduler. batch file generates log file displays put_lines. want see value assigned variable: v_chks_dm, couldn't figure out way it. tried get_line statement failed... know how it? thanks!
this what's in batch file:
echo off echo ****************************>>c:\output.log sqlplus userid/password@csdpro @v:\condition_test.sql>>c:\output.log
here's .sql file
declare v_chks_dm number; begin select /*+parallel (a,4)*/ count(distinct a.src_table) v_chks_dm 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;
one more question... if variable array? have this, got error says ora-06533: subscript beyond count. number of values in array varies 0 10, more. thanks!
declare type v_chks_array 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 mass collect arrsrcs hcr_dm.hcr_dm_fact a; dbms_output.put_line(arrsrcs(10)); end;
dbms_output.put_line('v_chkt_dm value = ' || v_chkt_dm);
or, better
dbms_output.put_line('v_chkt_dm value = ' || to_char(v_chkt_dm, '<number format>'));
you can take appropriate number formats in documentation.
variables batch-file plsql getline
Comments
Post a Comment