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 Volker Barth |
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 Breck Carter Thanks for the pointer and good to know, but I guess that would make the script much more incomprehensible in my particular requirement... I was sure I'd posted a suggestion about "more directives" in ISQL but I can't find it... it's something I would support as long as it doesn't go CRAZY like C. |
Yes, I'm aware that a possible enhancement for a current SA version won't make a pre-V10 engine change its behaviour. Kind of a very "post-mortem feature request":)