1 Reply Latest reply: Apr 23, 2013 3:42 PM by Chandrakaanth Ramamurthy RSS

    Executing sql query(not through sqlfile) from batchfile

    993159
      Hi,

      I have written a batchfile below which should execute the sql query. Can someone please help me in modifying the below code. I know we can make use of sql file ,but wanted it to be more robust and hence everything in a single batch file instead of having combination of sqlfile and batchfile.



      @echo off
      
      set ORACLE_HOME=%RAMBOH%
      set ORACLE_SID=%RAMBSID%
      
      set path=%RAMBOH%\bin;%RAMBOH%\admin\Ramb_Scripts;%path%
      
      sqlplus sys/XXX as sysdba
      
      @echo SET SERVEROUTPUT ON; 
      @echo DECLARE 
      @echo     v1   DATE; 
      @echo BEGIN 
      @echo     SELECT SYSDATE INTO V1 FROM DUAL; 
      @echo     DBMS_OUTPUT.PUT_LINE(v1); 
      @echo END; 
      @echo /