I would like to use one SQL script with DDL statements like CREATE TABLE for different SA versions and use (slightly) different syntax for these different versions.
E.g. SA 10 has introduced the VALIDATE authority (and REMOTE DBA authority is no more sufficient to VALIDATE), so for SA10 and newer, the script would contain a statement like
Naturally, a pre-V10 engine won't accept this syntax and will raise an error.
My simple tests with if statements like
do fail, as obviously the complete statement gets parsed even if the statements in the if-block won't get executed for a pre-V12 engine.
So, basically, I would like to use something like C's #ifdef/#ifdef directives for conditional compilation, i.e. a means to suppress the parsing of a script portion when a certain condition is false.
Is this possible with SQL Anyhwere and DBISQL?
Just to add: It will not be sufficient to skip such statements completely via on_error = continue. This might be sufficient in the above example, but in general the statements will have to be executed by all versions, and only particular clauses may be different.
asked 19 Oct '10, 08:42
EXECUTE IMMEDIATE won't throw a syntax error if it isn't executed.
( now, welcome to The World Of ''''''''Quotation Marks'''''''' :)
answered 19 Oct '10, 09:05