0

I have the following code:

sqlplus web/%password%@%SID% @ web.sql > weblog.log < NUL

if %ERRORLEVEL% > 0 GOTO SQLERROR

:SQLERROR

echo wrong credentials

The problem is, when I give wrong SID or password it pauses for some seconds and does not go to the error. Any help? Thanks.

2
  • It only pauses for a few seconds, it doesn't hang indefinitely - or at least until you hit return a few times, or interrupt it? Possible duplicate - does adding the -l flag make it behave how you want it to?. Commented Aug 2, 2017 at 18:31
  • It pauses for some secs, it does not respond to whatever i type except ctrl+c, the error is logged in weblog though. Commented Aug 2, 2017 at 18:33

1 Answer 1

0
if %ERRORLEVEL% gtr 0 GOTO SQLERROR

> is a redirector. You must use one of ==, gtr, geq, equ, neq, 'lss, 'leqin anif` statement.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. The delay was caused because of the 3 attempts to connect to the database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.