PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: set forceplan on/off
Date: Jul 16 2002 6:00PM

On Tue, 2002-07-16 at 10:10, David J Iannucci wrote:
> Does anyone know how to embed the function of the
> directive "set forceplan on/off" into a query?  I.e.
> to encode the table scanning order into the query
> syntax (thus making it possible to define the order
> for a join view without affecting the query calling the
> view) rather than having to specify "set forceplan
> on" before the query and "off" afterward?

I don't think that it's possible.

But depending on your situation you may be able to fake your way around
it, possibly by amending the SQL query before it is sent to the server.

If the query is sent to Sybase via sybperl (e.g. Sybase::CTlib) you
could write a perl function that takes a normal SQL request and adds the
SET FORCEPLAN bits at the top and at the bottom, and then executes the
query.

If you want to be as transparent as possible you could write a module
that implements its own version of ct_execute() and does the fix-up
under the covers.

This may not be the ideal solution, but it's what I can think of
off-hand without knowing the exact situation...

Michael
-- 
Michael Peppler / mpeppler@peppler.org / http://www.mbay.net/~mpeppler
mpeppler@zetatools.com / ZetaTools, Inc / http://www.zetatools.com
ZetaTools: Call perl functions as Sybase stored procedures!