Unix Technical Forum

Multi version procedures ?

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 ...


Go Back   Unix Technical Forum > Database Server Software > Sybase

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 03:50 PM
Dale Kerr
 
Posts: n/a
Default Multi version procedures ?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 03:50 PM
Pablo Sanchez
 
Posts: n/a
Default Re: Multi version procedures ?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 03:50 PM
Anthony Mandic
 
Posts: n/a
Default Re: Multi version procedures ?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 03:50 PM
Rob Verschoor
 
Posts: n/a
Default Re: Multi version procedures ?

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com