Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

query in string

5 posts in General Discussion Last posting was on 2003-10-24 10:07:46.0Z
digger Posted on 2003-10-23 10:21:19.0Z
From: "digger" <neltro@bigfoot.com>
Newsgroups: ianywhere.public.general
Subject: query in string
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
NNTP-Posting-Host: 202.74.0.162
X-Original-NNTP-Posting-Host: 202.74.0.162
Message-ID: <3f97ab9f$1@forums-1-dub>
Date: 23 Oct 2003 03:21:19 -0700
X-Trace: forums-1-dub 1066904479 202.74.0.162 (23 Oct 2003 03:21:19 -0700)
X-Original-Trace: 23 Oct 2003 03:21:19 -0700, 202.74.0.162
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1900
Article PK: 4149

hi all,

this is no way can do?

exec 'select * from tablename';

or is there any other workaround?


thanks in adv.


Breck Carter [TeamSybase] Posted on 2003-10-23 10:48:12.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: query in string
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <2ubfpvghk58ighpotpn9pr37gusmuveu96@4ax.com>
References: <3f97ab9f$1@forums-1-dub>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 23 Oct 2003 03:48:12 -0700
X-Trace: forums-1-dub 1066906092 64.7.134.118 (23 Oct 2003 03:48:12 -0700)
X-Original-Trace: 23 Oct 2003 03:48:12 -0700, bcarter.sentex.ca
Lines: 35
X-Authenticated-User: TeamPS
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1901
Article PK: 4150

Version 9 allows EXECUTE IMMEDIATE to return a result set.

BEGIN
DECLARE @sql LONG VARCHAR;
DECLARE @prod_id INTEGER;
SET @prod_id = 300;
SET @sql = STRING (
'SELECT * FROM sales_order_items WHERE prod_id = ',
@prod_id );
EXECUTE IMMEDIATE @sql;
END;

You can also put EXECUTE IMMEDIATE inside a stored procedure, and call
that procedure in a FROM clause as if it was a table.

Breck Thinks Version 9 Rocks!

On 23 Oct 2003 03:21:19 -0700, "digger" <neltro@bigfoot.com> wrote:

>hi all,
>
>this is no way can do?
>
>exec 'select * from tablename';
>
>or is there any other workaround?
>
>
>thanks in adv.
>

--
bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com


digger Posted on 2003-10-24 00:03:48.0Z
From: "digger" <neltro@bigfoot.com>
Newsgroups: ianywhere.public.general
References: <3f97ab9f$1@forums-1-dub> <2ubfpvghk58ighpotpn9pr37gusmuveu96@4ax.com>
Subject: Re: query in string
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
NNTP-Posting-Host: 202.74.0.162
X-Original-NNTP-Posting-Host: 202.74.0.162
Message-ID: <3f986c64@forums-1-dub>
Date: 23 Oct 2003 17:03:48 -0700
X-Trace: forums-1-dub 1066953828 202.74.0.162 (23 Oct 2003 17:03:48 -0700)
X-Original-Trace: 23 Oct 2003 17:03:48 -0700, 202.74.0.162
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1903
Article PK: 4151

How about version 8.02? Is it also possible?

"Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> wrote in
message news:2ubfpvghk58ighpotpn9pr37gusmuveu96@4ax.com...
> Version 9 allows EXECUTE IMMEDIATE to return a result set.
>
> BEGIN
> DECLARE @sql LONG VARCHAR;
> DECLARE @prod_id INTEGER;
> SET @prod_id = 300;
> SET @sql = STRING (
> 'SELECT * FROM sales_order_items WHERE prod_id = ',
> @prod_id );
> EXECUTE IMMEDIATE @sql;
> END;
>
> You can also put EXECUTE IMMEDIATE inside a stored procedure, and call
> that procedure in a FROM clause as if it was a table.
>
> Breck Thinks Version 9 Rocks!
>
> On 23 Oct 2003 03:21:19 -0700, "digger" <neltro@bigfoot.com> wrote:
>
> >hi all,
> >
> >this is no way can do?
> >
> >exec 'select * from tablename';
> >
> >or is there any other workaround?
> >
> >
> >thanks in adv.
> >
>
> --
> bcarter@risingroad.com
> Mobile and Distributed Enterprise Database Applications
> www.risingroad.com


Chris Keating (iAnywhere Solutions) Posted on 2003-10-24 00:20:18.0Z
From: "Chris Keating \(iAnywhere Solutions\)" <FightSpam_keating@iAnywhere.com>
Newsgroups: ianywhere.public.general
References: <3f97ab9f$1@forums-1-dub> <2ubfpvghk58ighpotpn9pr37gusmuveu96@4ax.com> <3f986c64@forums-1-dub>
Subject: Re: query in string
Lines: 50
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: keating-xp.sybase.com
X-Original-NNTP-Posting-Host: keating-xp.sybase.com
Message-ID: <3f987042$1@forums-1-dub>
Date: 23 Oct 2003 17:20:18 -0700
X-Trace: forums-1-dub 1066954818 172.31.140.66 (23 Oct 2003 17:20:18 -0700)
X-Original-Trace: 23 Oct 2003 17:20:18 -0700, keating-xp.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1904
Article PK: 4147

This feature was added in 9.0 and as such is not available in previous
versions.

/ck

"digger" <neltro@bigfoot.com> wrote in message news:3f986c64@forums-1-dub...
> How about version 8.02? Is it also possible?
>
> "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> wrote in
> message news:2ubfpvghk58ighpotpn9pr37gusmuveu96@4ax.com...
> > Version 9 allows EXECUTE IMMEDIATE to return a result set.
> >
> > BEGIN
> > DECLARE @sql LONG VARCHAR;
> > DECLARE @prod_id INTEGER;
> > SET @prod_id = 300;
> > SET @sql = STRING (
> > 'SELECT * FROM sales_order_items WHERE prod_id = ',
> > @prod_id );
> > EXECUTE IMMEDIATE @sql;
> > END;
> >
> > You can also put EXECUTE IMMEDIATE inside a stored procedure, and call
> > that procedure in a FROM clause as if it was a table.
> >
> > Breck Thinks Version 9 Rocks!
> >
> > On 23 Oct 2003 03:21:19 -0700, "digger" <neltro@bigfoot.com> wrote:
> >
> > >hi all,
> > >
> > >this is no way can do?
> > >
> > >exec 'select * from tablename';
> > >
> > >or is there any other workaround?
> > >
> > >
> > >thanks in adv.
> > >
> >
> > --
> > bcarter@risingroad.com
> > Mobile and Distributed Enterprise Database Applications
> > www.risingroad.com
>
>


Breck Carter [TeamSybase] Posted on 2003-10-24 10:07:46.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: query in string
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <qcthpvchr9q26fq0ftdcq8mee8sfg06541@4ax.com>
References: <3f97ab9f$1@forums-1-dub> <2ubfpvghk58ighpotpn9pr37gusmuveu96@4ax.com> <3f986c64@forums-1-dub>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
X-Original-Trace: 24 Oct 2003 03:12:03 -0700, bcarter.sentex.ca
Lines: 72
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 24 Oct 2003 03:00:40 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 24 Oct 2003 03:07:46 -0700
X-Trace: forums-1-dub 1066990066 10.22.108.75 (24 Oct 2003 03:07:46 -0700)
X-Original-Trace: 24 Oct 2003 03:07:46 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:1905
Article PK: 4153

What you *can* do in earlier versions is SELECT INTO #t to create a
temporary table inside the EXECUTE IMMEDIATE, and then SELECT FROM #t
after that.

CREATE PROCEDURE p_sales_order_items (
@prod_id INTEGER )
BEGIN
DECLARE @sql LONG VARCHAR;
SET @sql = STRING (
'SELECT * INTO #t ',
' FROM sales_order_items ',
' WHERE prod_id = ',
@prod_id,
' ORDER BY sales_order_items.id' );
EXECUTE IMMEDIATE @sql;
SELECT * FROM #t;
END;

CALL p_sales_order_items ( 300 );
CALL p_sales_order_items ( 301 );



Breck

On 23 Oct 2003 17:03:48 -0700, "digger" <neltro@bigfoot.com> wrote:

>How about version 8.02? Is it also possible?
>
>"Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com> wrote in
>message news:2ubfpvghk58ighpotpn9pr37gusmuveu96@4ax.com...
>> Version 9 allows EXECUTE IMMEDIATE to return a result set.
>>
>> BEGIN
>> DECLARE @sql LONG VARCHAR;
>> DECLARE @prod_id INTEGER;
>> SET @prod_id = 300;
>> SET @sql = STRING (
>> 'SELECT * FROM sales_order_items WHERE prod_id = ',
>> @prod_id );
>> EXECUTE IMMEDIATE @sql;
>> END;
>>
>> You can also put EXECUTE IMMEDIATE inside a stored procedure, and call
>> that procedure in a FROM clause as if it was a table.
>>
>> Breck Thinks Version 9 Rocks!
>>
>> On 23 Oct 2003 03:21:19 -0700, "digger" <neltro@bigfoot.com> wrote:
>>
>> >hi all,
>> >
>> >this is no way can do?
>> >
>> >exec 'select * from tablename';
>> >
>> >or is there any other workaround?
>> >
>> >
>> >thanks in adv.
>> >
>>
>> --
>> bcarter@risingroad.com
>> Mobile and Distributed Enterprise Database Applications
>> www.risingroad.com
>

--
bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com