sybase asa: result set from stored procedures

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
afred
Forum Newbie
Posts: 1
Joined: Fri Sep 17, 2004 10:03 am

sybase asa: result set from stored procedures

Post by afred »

How I can execute stored procedure with input and output parameters and have got output parameters at result set?

More about problem:

We have database (db) on Sybase ASA. And some stored procedures in the db.

Some stored procedures looks like:
dba.proc1 (in par1 int)
result (par2 int)
begin
...
end
and some others looks like:
dba.proc2(in par1 int, out par2 int)
begin
...
end
When I make standart query to proc1 like:

Code: Select all

$resource = sybase_query("call proc1('". $par1 ."')");
$result = sybase_fetch_array ($resource);
I've got result set at $result with par2 ($result['par2']).

But when I make the same query to proc2:

Code: Select all

$resource = sybase_query(''call proc2 ('". $par1 ."', '". $par2 ."')");
$result = sybase_fetch_array ($resource);
sybase_query work and query execute ok. I've got changes in db, but I couldn't get result set (the valume of $par2).

When I change sql query to:
CREATE VARIABLE VARIABLE par1;
CREATE VARIABLE VARIABLE par2;
SET par1 = 'something';
CALL proc2 (par1, par2);
SELECT par2 FROM DUMMY;
and execute this in sybase central - I've got my result set.

When I try execute last sql-query by php, I haven't got result set again.

So how I can execute stored procedure with input and output parameters and have got output parameters at result set?

Thank's for any ideas.
(sorry for bad English)
Post Reply