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.

How do we pass the column names in a variable in ASA 8.0?

3 posts in General Discussion Last posting was on 2003-05-15 10:00:53.0Z
Sathish Posted on 2003-05-10 18:51:10.0Z
From: Sathish
Date: Sat, 10 May 2003 14:51:10 -0400
Newsgroups: ianywhere.public.general
Subject: How do we pass the column names in a variable in ASA 8.0?
Message-ID: <ECB06BD8B89C2C0B00678FD885256D22.0067900285256D22@webforums>
Lines: 22
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:1009
Article PK: 3341

In ASA 8.0, inside a stored procedure,we need to pass the condition in a
query, through a variable.

Example:
create procedure(@variable1)
as
begin

insert into tab1 select col1, col2, col3 from tab2, tab3 where
tab2.col3=tab3.col4 + @variable1

end

@variable1 would be equal to something like
@variable1= 'AND (tab2.col7='xyz' and tab2.col7>100) OR tab2.col9 is not
null'

so, we are passing the column names in a variable.
storing the insert query in a variable say @query1 and

execute @query1, inside the SP, gives an error, "Procedure @query1 not
found".

How do we pass the column names in a variable in ASA 8.0?


Breck Carter [TeamSybase] Posted on 2003-05-10 19:00:06.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Subject: Re: How do we pass the column names in a variable in ASA 8.0?
Date: Sat, 10 May 2003 15:00:06 -0400
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <muiqbvkrlhdf6gl48kcp7nlq7ohjgmgcbf@4ax.com>
References: <ECB06BD8B89C2C0B00678FD885256D22.0067900285256D22@webforums>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: bcarter.sentex.ca 64.7.134.118
Lines: 29
Path: forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:1011
Article PK: 2983

Try EXECUTE IMMEDIATE. If you still get that bogus error, surround the
EXECUTE IMMEDIATE with BEGIN and END. I am not sure the reason, but I
think it's a parser thing, involving confusion among the dialects
Transact SQL and Watcom SQL, which can sometimes be mixed and
sometimes not.

Breck

On Sat, 10 May 2003 14:51:10 -0400, Sathish wrote:

>In ASA 8.0, inside a stored procedure,we need to pass the condition in a
>query, through a variable.
>
>Example:
>create procedure(@variable1)
>as
>begin
>
>insert into tab1 select col1, col2, col3 from tab2, tab3 where
>tab2.col3=tab3.col4 + @variable1
>
>end
>
>@variable1 would be equal to something like
>@variable1= 'AND (tab2.col7='xyz' and tab2.col7>100) OR tab2.col9 is not
>null'
>
>so, we are passing the column names in a variable.
>storing the insert query in a variable say @query1 and
>
>execute @query1, inside the SP, gives an error, "Procedure @query1 not
>found".
>
>How do we pass the column names in a variable in ASA 8.0?

bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
http://www.risingroad.com


C Pulv Posted on 2003-05-15 10:00:53.0Z
From: "C Pulv" <cpulvirenti@visualsoftware.it>
References: <ECB06BD8B89C2C0B00678FD885256D22.0067900285256D22@webforums>
Subject: Re: How do we pass the column names in a variable in ASA 8.0?
Date: Thu, 15 May 2003 12:00:53 +0200
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
Message-ID: <O422bosGDHA.358@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: 81.117.237.161
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:1019
Article PK: 2990

Try to use a function like :

insert into .... where fn_get_var(xx, yy, xx) = 1

In function's body you can write all that you want :

If xx = yy and zz > 100 then
set li_return = 1
else
...
end if
return li_return



<Sathish> ha scritto nel messaggio
news:ECB06BD8B89C2C0B00678FD885256D22.0067900285256D22@webforums...

> In ASA 8.0, inside a stored procedure,we need to pass the condition in a
> query, through a variable.
>
> Example:
> create procedure(@variable1)
> as
> begin
>
> insert into tab1 select col1, col2, col3 from tab2, tab3 where
> tab2.col3=tab3.col4 + @variable1
>
> end
>
> @variable1 would be equal to something like
> @variable1= 'AND (tab2.col7='xyz' and tab2.col7>100) OR tab2.col9 is not
> null'
>
> so, we are passing the column names in a variable.
> storing the insert query in a variable say @query1 and
>
> execute @query1, inside the SP, gives an error, "Procedure @query1 not
> found".
>
> How do we pass the column names in a variable in ASA 8.0?