Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing a query result on a variable ¦ HELP!!! ¦

Status
Not open for further replies.

Japoneis

Programmer
Sep 3, 2003
16
BR
Hi there, I´m trying to migrate my DB from Sybase to MySQL. So far it´s going quite well, but I found a problem. Using Sybase I can store the result of a query in a variable on my client application (PowerBuilder) using the syntax:

SELECT xxxx COUNT
INTO :VARIABLE <---
FROM xxx

Where VARIABLE is a global variable on my client application.

I already read the MySQL manual and didn´t find anything. I really don´t want to store the results on another table, so if you guys can help me ...
 
hopefully this will give you the right idea, set avariable, then use it .
Code:
mysql> select @karver:='i am a variable';
+----------------------------+
| @karver:='i am a variable' |
+----------------------------+
| i am a variable            |
+----------------------------+
1 row in set (0.00 sec)

mysql> select @karver;
+-----------------+
| @karver         |
+-----------------+
| i am a variable |
+-----------------+
1 row in set (0.00 sec)


select somstuff from table where something = @variable;

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Thank´s for the help, but that´s not quite what I want ...

What I need is to pass the result of a query to a variable in my client application (PowerBuilder), not a variable in MySQL. Using Sybase I can do this by using the syntax --> INTO :variable
Is there anything like this in MySQL ???
 
Uh, you need to fetch the row from the result set and store it in a variable in your client.

//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top