SQLPLUS and Windows Batch Files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pseit01
    New Member
    • Sep 2007
    • 1

    SQLPLUS and Windows Batch Files

    I am looking for an example of how to capture a return code from within a Windows Batch (.bat) file that executes a SQLPLUS command. The SQL script will either exit with EXIT(0) or EXIT(n). If the exit is greater than ZERO, then the .BAT file will need to perform additional logic
  • fhkhan78
    New Member
    • Sep 2006
    • 5

    #2
    Originally posted by pseit01
    I am looking for an example of how to capture a return code from within a Windows Batch (.bat) file that executes a SQLPLUS command. The SQL script will either exit with EXIT(0) or EXIT(n). If the exit is greater than ZERO, then the .BAT file will need to perform additional logic

    simply right click on the batch file and click on edit the file will be open in the note pad

    Comment

    • kbilal
      New Member
      • Jan 2008
      • 1

      #3
      Use host command to execute the batch file like the example given below:

      host(abc.bat);

      Comment

      • Orawonster
        New Member
        • Feb 2008
        • 1

        #4
        %ERRORLEVEL% might be what you want to look into

        Comment

        • subashsavji
          New Member
          • Jan 2008
          • 93

          #5
          Originally posted by pseit01
          I am looking for an example of how to capture a return code from within a Windows Batch (.bat) file that executes a SQLPLUS command. The SQL script will either exit with EXIT(0) or EXIT(n). If the exit is greater than ZERO, then the .BAT file will need to perform additional logic
          this may be useful to you..

          PROCEDURE rcv_data IS
          h9 varchar2(1200);
          fnd varchar2(1);
          fr number;
          lr number;

          BEGIN
          fr:=0;
          lr:=0;

          H9:='imp80 CORE/CORE@ibm tables=(ct_tcv_ indent_bk,ct_tc v_bk,ct_tcv_ind _local_bk) file='||:FILE_N AME;
          MESSAGE(H9);
          MESSAGE(H9);
          host(h9);

          SELECT 'X' INTO FND FROM USER_TABLES WHERE TABLE_NAME='CT_ TCV_INDENT_BK';

          select count(*) into fr from CT_TCV_INDENT;

          IF SQL%NOTFOUND THEN
          MESSAGE('ERROR - 9898 NOT IMPORTED ');
          ELSE

          MESSAGE('IMPORT ED ');
          INSERT INTO CT_TCV SELECT * FROM CT_TCV_BK WHERE (AC_YEAR_CODE,T CS_TCS_NO,TCS_T CS_DATE,TRIP_BR ANCH_BRANCH_COD E)
          commit;
          end if;

          END;

          Comment

          Working...