4est
4est

Reputation: 3168

Run sql script from bat file (oracle, batch)

I have bat script:

@echo off
cls
:start
sqlplus user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=X.Y.Z.F)(Port=1521))
                               (CONNECT_DATA=(SID=some_sid))) @test.sql
goto end

:end
pause 0

and my test.sql

DECLARE
test varchar2(32000);
BEGIN
  test:='value';
  DBMS_OUTPUT.PUT_LINE('string test');
  DBMS_OUTPUT.PUT_LINE(test||' test');
END;

When I run it I got this:

enter image description here

What it means?

Upvotes: 0

Views: 772

Answers (1)

cdub
cdub

Reputation: 2297

You need to enter a forward slash (/) to flush the buffer.

DECLARE
test varchar2(32000);
BEGIN
  test:='value';
  DBMS_OUTPUT.PUT_LINE('string test');
  DBMS_OUTPUT.PUT_LINE(test||' test');
END;
/   <<<<<<<<<<<<<----- forward slash

Upvotes: 5

Related Questions