Dynamic SQL with Sybase 11 
Author Message
 Dynamic SQL with Sybase 11

Dear companions,

I'm no Sybase SQL Server 11 expert (yet...) but am trying to implement a
Stored Procedure which has to use Dynamic SQL (used this with
IBM's DB2). The reason is that one of the supplied parameters has to be
used to select the table to be queried.

Can anyone help me quickly with this or is it just a RTFM?

Greetings from a DBA in stress..

Nick van Gerwen



Tue, 29 Feb 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11

Dear companions,

I'm no Sybase SQL Server 11 expert (yet...) but am trying to implement a
Stored Procedure which has to use Dynamic SQL (used this with
IBM's DB2). The reason is that one of the supplied parameters has to be
used to select the table to be queried.

Can anyone help me quickly with this or is it just a RTFM?

Greetings from a DBA in stress..

Nick van Gerwen



Tue, 29 Feb 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11

Dear companions,

I'm no Sybase SQL Server 11 expert (yet...) but am trying to implement a
Stored Procedure which has to use Dynamic SQL (used this with
IBM's DB2). The reason is that one of the supplied parameters has to be
used to select the table to be queried.

Can anyone help me quickly with this or is it just a RTFM?

Greetings from a DBA in stress..

Nick van Gerwen



Tue, 29 Feb 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11

 Unlike Oracle, Sybase System 11 stored procedures have no Dynamic SQL
capabilities.....Another blow for Sybase...


Quote:
>Dear companions,

>I'm no Sybase SQL Server 11 expert (yet...) but am trying to implement a
>Stored Procedure which has to use Dynamic SQL (used this with
>IBM's DB2). The reason is that one of the supplied parameters has to be
>used to select the table to be queried.

>Can anyone help me quickly with this or is it just a RTFM?

>Greetings from a DBA in stress..

>Nick van Gerwen




Tue, 29 Feb 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11


: I'm no Sybase SQL Server 11 expert (yet...) but am trying to implement a
: Stored Procedure which has to use Dynamic SQL (used this with
: IBM's DB2). The reason is that one of the supplied parameters has to be
: used to select the table to be queried.
:
: Can anyone help me quickly with this or is it just a RTFM?

Yes and yes.  :-)  You can't do dynamic SQL in procedures, the reason
being that the procedure verifies the existence of all objects as part
of the compilation process.  Therefore, object names cannot be
variables.  :-(  You either need to do this kind of thing in a program
(C or the language of your choice) or use shell scripts that dynamically
create the SQL statement you want to execute and then send that
statement to the server.  You might want to look into Sybperl -- it's
kind of the best of both worlds.  :-)

                                Good luck,
                                Teresa Larson

     _________________________________________________________________
    /  Teresa A. Larson                 http://www2.ari.net/jmasino/ /
   /  Bell Atlantic                          Voice: (301) 282-0224  /
  /  13100 Columbia Pike, A-3-3              Fax:   (301) 282-9416 /

/________________________________________________________________/
                      #include <std_disclaimer>



Tue, 29 Feb 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11


Quote:
>  Unlike Oracle, Sybase System 11 stored procedures have no Dynamic SQL
> capabilities.....Another blow for Sybase...

Care to list other "blows" for Sybase?  I don't mean the standard
{*filter*}that you hear from other vendor's marketing staff but real
"blows".
--

--------------+-----------------+--------------------------------------------



Tue, 29 Feb 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11

Quote:


> >  Unlike Oracle, Sybase System 11 stored procedures have no Dynamic SQL
> > capabilities.....Another blow for Sybase...

> Care to list other "blows" for Sybase?  I don't mean the standard
> {*filter*}that you hear from other vendor's marketing staff but real
> "blows".

        Where would you like us to start Pa'blow?
        Sybase doesn't have Oracle's powerful 'decode()' function ;-)

-am



Sat, 04 Mar 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11

Quote:

> I'm no Sybase SQL Server 11 expert (yet...) but am trying to implement a
> Stored Procedure which has to use Dynamic SQL (used this with
> IBM's DB2). The reason is that one of the supplied parameters has to be
> used to select the table to be queried.

        Sybase has Dymanic SQL, but not in the way you'd expect. Its restricted
        to Embedded SQL usage and doesn't support sprocs. Look up the
        Embedded SQL/C and Embedded SQL/COBOL Programmer's Guides. That's
        the only Sybase manual which makes any reference to dynamic SQL
        (apart from the 'What's New in Sybase SQL Server Release 11.0?'
        manual).

        That said, you could write your sprocs in such a way as to call
        other sprocs that do the desired table select you want. However,
        this coud still be restrictive since you still can't dynamically
        specify the selection fields or the where clause etc.

-am



Sat, 04 Mar 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11

You may be able to accomplish what you need by using a SP that starts a
cursor.

Robert

Quote:

> Dear companions,

> I'm no Sybase SQL Server 11 expert (yet...) but am trying to implement a
> Stored Procedure which has to use Dynamic SQL (used this with
> IBM's DB2). The reason is that one of the supplied parameters has to be
> used to select the table to be queried.

> Can anyone help me quickly with this or is it just a RTFM?

> Greetings from a DBA in stress..

> Nick van Gerwen




Sun, 05 Mar 2000 03:00:00 GMT
 Dynamic SQL with Sybase 11

Quote:



> > >  Unlike Oracle, Sybase System 11 stored procedures have no Dynamic SQL
> > > capabilities.....Another blow for Sybase...

> > Care to list other "blows" for Sybase?  I don't mean the standard
> > {*filter*}that you hear from other vendor's marketing staff but real
> > "blows".

>    Where would you like us to start Pa'blow?
>    Sybase doesn't have Oracle's powerful 'decode()' function ;-)

:-)!
--

--------------+-----------------+--------------------------------------------



Sun, 05 Mar 2000 03:00:00 GMT
 
 [ 10 post ] 

 Relevant Pages 

1. Sybase SQL Sever 11 Dynamic SQL

2. migrate Sybase 11.0.1 and Sybase 11.5.1 to MS sql 6.5/7.0

3. Upgrade from Sybase SQL Server 11.0.1 to Sybase ASE 11.9.2

4. Dynamic SQL exec in Sybase 11.5.1

5. Dynamic SQL in Stored Procedures in System 11.5-11.9

6. MaximDevice limit for SQl Server 11-11.5 (was: Sybase 2Gb Limit)

7. Dynamic Intranet Web page of sybase 11 data

8. Using Sybase Central with Sybase SQL Server 11.0.3

9. history server 11.9.2.1 on Sybase 11.0.3.3

10. Newbie: Sybase ASE 11.9.2 vs 11.5.1

11. Error when upgrading Sybase 11.0.2 to 11.0.3

12. signal 11 errors in sybase 11.0.3.3 ebf 8298


 
Powered by phpBB® Forum Software