dbTalk Databases Forums  

Procedure sending parameter

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Procedure sending parameter in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
 
Posts: n/a

Default Procedure sending parameter - 12-11-2003 , 10:56 AM






Hi,

I need some help in the below procedure.
I have a column in the table empid the values are like 1000,2002,3000
etc...,,
I want to send these values to a procedure as an in parameter. So how it can
be solved..?

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;
select * from sample where empid in (local1) ;
end

I want to call this procedure like this way ...

call dba.test('1000,2002,3000')

The problem is... I have a big procedure in that previously I used to send a
single value but now I want to send a multiple values.. So I need to change
a lot of code.

thanks in advance
chandhu



Reply With Quote
  #2  
Old   
Frank
 
Posts: n/a

Default Re: Procedure sending parameter - 12-11-2003 , 01:08 PM






Hi ya

try this

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;
execute ('select * from sample where empid in (' + local1 + ')') ;
end

<chandrasekhars (AT) i-vantage (DOT) com> a écrit dans le message de
news:3fd8a1d2 (AT) forums-1-dub (DOT) ..
Quote:
Hi,

I need some help in the below procedure.
I have a column in the table empid the values are like 1000,2002,3000
etc...,,
I want to send these values to a procedure as an in parameter. So how it
can
be solved..?

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;
select * from sample where empid in (local1) ;
end

I want to call this procedure like this way ...

call dba.test('1000,2002,3000')

The problem is... I have a big procedure in that previously I used to send
a
single value but now I want to send a multiple values.. So I need to
change
a lot of code.

thanks in advance
chandhu





Reply With Quote
  #3  
Old   
chandhu
 
Posts: n/a

Default Re: Procedure sending parameter - 12-12-2003 , 12:00 AM



Hi,
I got the error message SELECT retuns more than one row..
Chandhu
"Frank" <fmorin (AT) cim-solutions (DOT) net> wrote

Quote:
Hi ya

try this

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;
execute ('select * from sample where empid in (' + local1 + ')')
;
end

chandrasekhars (AT) i-vantage (DOT) com> a écrit dans le message de
news:3fd8a1d2 (AT) forums-1-dub (DOT) ..
Hi,

I need some help in the below procedure.
I have a column in the table empid the values are like 1000,2002,3000
etc...,,
I want to send these values to a procedure as an in parameter. So how it
can
be solved..?

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;
select * from sample where empid in (local1) ;
end

I want to call this procedure like this way ...

call dba.test('1000,2002,3000')

The problem is... I have a big procedure in that previously I used to
send
a
single value but now I want to send a multiple values.. So I need to
change
a lot of code.

thanks in advance
chandhu







Reply With Quote
  #4  
Old   
Frank
 
Posts: n/a

Default Re: Procedure sending parameter - 12-12-2003 , 12:25 PM



Sorry, it works in MSSQL, I mixed up my knowledge.

I have something else for you.You could use temporary table :
Here is a sample

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;

//Put as many field you need to have the same number then sample table
create table #testTable
( field1 varchar(100)
, field2 int
...
...
);

execute (' insert into #testTable select * from sample where empid
in (' + local1 + ')');
select * from #testTable;

// Don't have to drop because table is drop when procedure is ended.
// But I prefer to do it myself to be sure
drop table #testTable
end


"chandhu" <chandrasekhars (AT) i-vantage (DOT) com> a écrit dans le message de
news:3fd95977 (AT) forums-1-dub (DOT) ..
Quote:
Hi,
I got the error message SELECT retuns more than one row..
Chandhu
"Frank" <fmorin (AT) cim-solutions (DOT) net> wrote in message
news:3fd8c098 (AT) forums-1-dub (DOT) ..
Hi ya

try this

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;
execute ('select * from sample where empid in (' + local1 +
')')
;
end

chandrasekhars (AT) i-vantage (DOT) com> a écrit dans le message de
news:3fd8a1d2 (AT) forums-1-dub (DOT) ..
Hi,

I need some help in the below procedure.
I have a column in the table empid the values are like 1000,2002,3000
etc...,,
I want to send these values to a procedure as an in parameter. So how
it
can
be solved..?

alter procedure DBA.test(in local1 varchar(60))
begin
message local1 to client;
select * from sample where empid in (local1) ;
end

I want to call this procedure like this way ...

call dba.test('1000,2002,3000')

The problem is... I have a big procedure in that previously I used to
send
a
single value but now I want to send a multiple values.. So I need to
change
a lot of code.

thanks in advance
chandhu









Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.