Defining multiple SQL language handlers  Using Catalog Stored Procedures (CSPs)

Chapter 3: Configuring a TRS

Adaptive Server stored procedure example

Following is an example of creating an Adaptive Server stored procedure that connects to TRS and uses a parameter to choose the DB2 UDB system to use:

create proc dbp1
              @salary int
            as
              if @salary < 60000
                   exec BLUETRS...MIAMIrpc "select * from payroll"
            else
                   exec BLUETRS...DALLASrpc "select * from payroll"

In this example, the Adaptive Server is configured to connect to the TRS named BLUETRS and to execute an RPC. The value of the @salary parameter determines the language RPC that the TRS named BLUETRS uses to route the select statement. Based on the value of @salary, one of the following occurs:





Copyright © 2005. Sybase Inc. All rights reserved. Using Catalog Stored Procedures (CSPs)

View this book as PDF