This is a discussion on Multi version procedures ? within the Sybase forums, part of the Database Server Software category; --> I'm guessing that this can't be done, but am I able to write a single procedure using functions and ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm guessing that this can't be done, but am I able to write a single procedure using functions and environment variables that don't exist in that version, but using an IF statement to execute the correct code based on the ASE version? For example: IF version >= 12.5 run this ELSE run this instead If I execute my procedure on 12.5, no problem. But to execute on 12.0, I will get the errors: Msg 137, Level 15, State 2: Must declare variable ... or Msg 195, Level 15, State 10: .... is not a recognized built-in function name. So is there any way to successfully compile the procedure, and avoid these errors, or do I really have to write a separate procedure per ASE version (unless I use a common denominator approach)? Regards, Dale Kerr Melbourne, Australia |
| |||
| dalekerrNOSPAM@lycos.com (Dale Kerr) wrote in news:9710df07.0308141730.369147b2@posting.google.c om: > So is there any way to successfully compile the procedure, and avoid > these errors, or do I really have to write a separate procedure per > ASE version (unless I use a common denominator approach)? Hi Dale! One thought is to 'compile' your SP's by using a pre-processor to generate the respective SQL in your SP's. You might use m4 or cpp and create a Makefile: make 12.5 make 12.0 etc HTH! -- Pablo Sanchez, Blueoak Database Engineering http://www.blueoakdb.com |
| |||
| Dale Kerr wrote: > > I'm guessing that this can't be done, but am I able to write a single > procedure using functions and environment variables that don't exist > in that version, but using an IF statement to execute the correct code > based on the ASE version? .... > So is there any way to successfully compile the procedure, and avoid > these errors, or do I really have to write a separate procedure per > ASE version (unless I use a common denominator approach)? You'd either have to go with the lowest common denominator, use sub-procedures (which isn't really a solution) or, if you are on a Unix platform, use a precompiler trick with macros. You should be able to pass your code thru an m4 parser. -am © 2003 |
| ||||
| Yes, this is possible; in fact, in a number of different ways. Chapter 1 of my book "Tips, Tricks & Recipes for Sybase ASE" (www.sypron.nl/ttr) tells you how to do this... HTH, Rob ------------------------------------------------------------- Rob Verschoor Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0 and Replication Server 12.5 Author of "Tips, Tricks & Recipes for Sybase ASE" and "The Complete Sybase ASE Quick Reference Guide" Online orders accepted at http://www.sypron.nl/shop mailto:rob@DO.NOT.SPAM.sypron.nl.REMOVE.THIS.DECOY http://www.sypron.nl Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands ------------------------------------------------------------- "Dale Kerr" <dalekerrNOSPAM@lycos.com> wrote in message news:9710df07.0308141730.369147b2@posting.google.c om... > I'm guessing that this can't be done, but am I able to write a single > procedure using functions and environment variables that don't exist > in that version, but using an IF statement to execute the correct code > based on the ASE version? > > For example: > > IF version >= 12.5 > run this > ELSE > run this instead > > If I execute my procedure on 12.5, no problem. But to execute on 12.0, > I will get the errors: > > Msg 137, Level 15, State 2: > Must declare variable ... > > or > > Msg 195, Level 15, State 10: > ... is not a recognized built-in function name. > > So is there any way to successfully compile the procedure, and avoid > these errors, or do I really have to write a separate procedure per > ASE version (unless I use a common denominator approach)? > > Regards, > > Dale Kerr > Melbourne, Australia |