Want to run sql script (written in window batch file) on oracle DB
<p><strong>Snippet of Batch file</strong> </p>

<pre><code>:: This setlocal is done to use variable syntax '!varname!' in nested for loop
setlocal  enableextensions enabledelayedexpansion
echo on
SET AUTOMATION_ACCOUNT_ID = some value
SET DB_SERVER_NAME = some value
SET DB_NAME = some value
SET all remaining variables

::AUTOMATION_ACCOUNT_CHECK
:: Checking if Automation Account is already created on DB (If not then create it first &amp; then move to FREE_TRAIL_ACCOUNT_CHECK process)*

FOR /F "usebackq tokens=1" %%i IN (`sqlcmd -S %DB_SERVER_NAME% -h -1 -d %DB_NAME% -U %DB_SERVER_USERNAME% -P %DB_SERVER_PASSWORD% -Q"set nocount on; select (count(*)) from dbo.[ACCOUNTS] where ACCOUNT_ID ='%AUTOMATION_ACCOUNT_ID%';"`) DO set ACCOUNTCOUNT=%%i

echo "ACCOUNT COUNT is "!ACCOUNTCOUNT!
if !ACCOUNTCOUNT!==0 goto CREATE_AUTOMATION_ACCOUNT:
goto FREE_TRAIL_ACCOUNT_CHECK:`
</code></pre>

<p>I want above script to be executed on oracle instance . </p>

<p>Through googling I came to know that sqlcmd won't work for oracle DB , i have to use sqlplus instead . Using sqlplus , I converted above script as follows</p>

<pre><code>::AUTOMATION_ACCOUNT_CHECK
:: Checking if Automation Account is already created on DB (If not then create it first &amp; then move to FREE_TRAIL_ACCOUNT_CHECK process)

 FOR /F "usebackq tokens=1" %%i IN ('sqlplus            
 %DB_SERVER_USERNAME%/%DB_SERVER_PASSWORD%@%DB_SERVER_NAME% @sqlscript.sql') DO @set ACCOUNTCOUNT=%%i
echo "ACCOUNT COUNT is "!ACCOUNTCOUNT!
</code></pre>

<p>where sqlscript.sql contains</p>

<p><code>SELECT COUNT(*) from ACCOUNTS;
 exit;</code></p>

<p>However this is not working as I am getting following response in command prompt when trying to execute this batch file </p>

<pre><code> C:\Setup&gt;FOR /F "usebackq tokens=1" %i IN ('sqlplus uname/pwd@host:port @sqlscript.sql') DO @set ACCOUNTCOUNT=%i 

 C:\Setup&gt;echo "ACCOUNT COUNT is "!ACCOUNTCOUNT! 
 "ACCOUNT COUNT is "sqlplus
 C:\Setup&gt;exit /B 0 
</code></pre>

<p>I am geting this 'sqlplus' printed instead of Account count ...
Can you guys help me to resolve this stuff ?</p>

<p>Moreover when I execute same stuff on sqlplus utility , it works 
<a href="https://i.stack.imgur.com/iiAtI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iiAtI.png" alt="enter image description here"></a></p>