Subscribe to this feed

Navigation

Recent Posts

Archive

Popular Tags

Click tag to retrieve blogs
  1. Excel (9)
  2. Oracle (6)
  3. csv (5)
  4. batch files (5)
  5. PHP (3)
  6. SQLPLus (3)
  7. VBA (3)
  8. Apache (3)
  9. DOS (3)
  10. SQL*Plus (3)
  11. Macro (3)
  12. bat (3)
  13. data migration (2)
  14. System Implementation (2)
  15. MySQL (2)
  16. Microsoft (2)
  17. Windows (2)
  18. new systems (2)
  19. SQL (2)
  20. Updates (1)
  21. Prince2 (1)
  22. MSDOS (1)
  23. Import file (1)
  24. ISERR (1)
  25. testing (1)

Exit SQLPlus from Batch File

Saturday 05 May, 2007 - 12:57pm | 0 comments |

If you have a batch file set to run multiple SQLPlus queries and to then perform some other action such as merge the results together into a single file, or copy the files elsewhere you need to physically exit SQLPlus or the batch file will not continue to run and execute the commands.

To exit SQLPlus automatically skip a line after your last query and type exit as in

@C:\Queries\Query_1.sql
@C:\Queries\Query_2.sql
@C:\Queries\Query_3.sql
@C:\Queries\Query_4.sql

EXIT

Tags:SQLPlus |Oracle |DOS |bat |batch file

Comment
 | Link | Back to top | del.icio.us digg it furl reddit

Run Multiple SQLPlus Queries via DOS batch file

Saturday 05 May, 2007 - 12:51pm | 5 comments |

To run multiple SQLPlus queries as part of a DOS batch file place all the queries in a separate SQL file. For Example

@C:\Queries\Query_1.sql
@C:\Queries\Query_2.sql
@C:\Queries\Query_3.sql
@C:\Queries\Query_4.sql

Save the file as runall.sql. Then use this file in your batch file

@Echo Off
sqlplus [login details] @C:\queries\runall.sql
EXIT

Tags:SQLPlus |bat |DOS |Oracle

Comment
 | Link | Back to top | del.icio.us digg it furl reddit

Use Query Result as Variable in Batch File

Tuesday 01 May, 2007 - 10:47am | 0 comments |

You can use the result of a SQLPlus query as a variable in a windows batch file by spooling the output to a .bat file

SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET WRAP OFF
SET LINESIZE 1000
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET MARKUP HTML OFF
SPOOL c:cdr_count.bat;
select
'@echo off' from dual
UNION ALL
select 
'SET CDR='||''||count(ddi) from cdrs where trunc(sysdate) = trunc(adj_start_time);
SPOOL OFF;

This creates or replaces a batch file and outputs

@echo off
SET CDR=643950

I am then able to call that batch file from within another batch file and use the SQL query result as it is defined as a variable.

call c:cdr_count.bat
IF %CDR% EQU 0 GOTO END

Tags:SQLPLus |Oracle |DOS |Batch files

Comment
 | Link | Back to top | del.icio.us digg it furl reddit

© Eriginal Ltd 2011, all rights reserved