on 05-26-2009 5:15 PM
Hello,
I'm hoping someone can advise me on the return code from sqlcli.
I would like to get a different return code back from the program based on whether or not the query succeeded or faild.
For example when calling from a Windows batch file.
sqlcli -n server -d MAXDB1 -u USER,pw "SELECT 1 FROM DUAL"
%errorlevel% is 0
When calling with a bad SQL statement
sqlcli -n server -d MAXDB1 -u USER,pw "BAD SQL"
Results in this return information:
-3005: POS(1) Invalid SQL statement SQLSTATE: 42000
But %errorlevel% is still 0
I tried the -E option to set a different return value but any value I set is returned whether or not the SQL statement succeeds.
Is there a way to determine whether or not the SQL statement was successful by checking the return value?
Thanks,
Troy
OK,
Would you happen to know the purpose of the -E option?
The value I set using that option always appears to be the return code from sqlcli whether or not there are any errors.
Thanks,
Troy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Would you happen to know the purpose of the -E option?
> The value I set using that option always appears to be the return code from sqlcli whether or not there are any errors.
Yep - looks like this is the case.
Since the documentation is not very elaborate on this, I'm gonna drop the developer a line.
regards,
Lars
statement succeeds.
>
> Is there a way to determine whether or not the SQL statement was successful by checking the return value?
No, there isn't such a way.
The program itself worked as it should and handling SQL-errors that may occur won't leave sqlcli with a returncode <>0.
regards,
Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.