What's the equivalent of SET NOEXEC ON in SQL Anywhere? I want to validate a stored procedure without creating it.
Request clarification before answering.
A different approach is to run DBISQL/dbisqlc with the -x option and to supply the SQL statements that should be checked as a command or a SQL file.
According to the docs, that
scans commands but does not execute them. This is useful for checking long command files for syntax errors.
For example (cf. Breck's 3rd example):
"%SQLANY11%\\bin32\\dbisql" -c <ConnectInfo> -x CREATE PROCEDURE p() AS garbage
will return SQLCODE -131 as expected.
----------Addition----------
In a batch environment, one may use the ERRORLEVEL variable to check the result, something like
"%SQLANY11%\\bin32\\dbisql" -c <ConnectInfo> -x CREATE PROCEDURE p() AS garbage
if errorlevel 1 echo Invalid SQL batch returns ERRORLEVEL: %errorlevel%
Correct syntax returns ERRORLEVEL 0 (EXIT_OK = Success). The above sample sets the ERRORLEVEL to 1 (i.e. EXIT_FAIL = General failure). Can't say if this happens for all kinds of invalid constructs, though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Breck: Yes, it does (as documented) - see my edits.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.