I am trying to execute a PL/SQL script in a batch file in Windows 7 Prof sp1
Step 1) I wrote a simple PL/SQL script:
--
-- Scope of variables
--
DECLARE
v_sal number(7,2) := 50000;
v_comm number(7,2) := v_sal * .20;
v_message varchar2(100) := ' eligible for commission';
BEGIN
declare
v_sal number(7,2) :=50000;
v_comm number(7,2) :=0;
v_total_comp number(7,2) := v_sal+v_comm;
begin
v_message := 'Clerk not'||v_message;
dbms_output.put_line ('Subblock message is '|| v_message);
dbms_output.put_line ('Subblock v_comm is '|| v_comm);
end;
v_message := 'Salesman' || v_message;
-- dbms_output.put_line ('Main block v_total_comp '|| v_total_comp); -- Error: not visible in main block
dbms_output.put_line ('Main block v_comm '|| v_comm);
dbms_output.put_line ('Main block message is '|| v_message);
END;
/
Step 2) Then I wrote a simple batch file TstBatch.bat
sqlplus scott/tiger@orcl<PLSqlVarInputTst1.sql>>TstBatch.log
Step 3) In DOS cmd, I tried to execute TstBatch.bat
C:> TstBatch.bat
The log file tells me I have connected to Oracle Database 11g Enterprise Edition Release ...
Then a lot of SQL> SQL> SQL>... repeated 26 times
PL/SQL procedue successfully completed.
Disconnected from Oracle Database
I also tried executing the PLSQL script in SQLPlus:
SQL:>@PLSqlVarInputTst1.sql
Tells me the procedure successfully completed.
QUESTION: So where is the output from the PL/SQL script?