• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query consisting of if statements, looping, cases on mysql?

 
alsoumahi alBatal
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi experts , how do I make a query consists of if statements , looping , cases on mysql

it is like a piece of code runs as query to retrieve information , I have read stored procedures to do that , but stored procedures couldn't help me with my specific requirements because
stored procedures don't support storing result set in temporary variable , and can't return result set as data type ,... etc

so how can I achieve this , make program as a query , run it and get result
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alsoumahi alBatal wrote:it is like a piece of code runs as query to retrieve information , I have read stored procedures to do that , but stored procedures couldn't help me with my specific requirements because
stored procedures don't support storing result set in temporary variable , and can't return result set as data type ,... etc

They do for most major databases. What database are you using? (It's done somewhat differently for different databases.)
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alsoumahi alBatal wrote:stored procedures don't support storing result set in temporary variable , and can't return result set as data type

Many databases support temporary tables or arrays of some sort.
 
alsoumahi alBatal
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

They do for most major databases. What database are you using? (It's done somewhat differently for different databases.)


thanks for reply , I am using mysql database . usually what I do a retrieve a result set from database using select statement (normal query ) then in my java program I am doing the anaylsis/filtering/processing on that result set , but on tha way it takes a lot of time sometimes I have large data so it takes have hour approximately

however if I do a query that gives me end of result set so directly I will show it in my web page , because getting query(analyzed one , processed query ) from database faster than the normal process which I am using through java program.
 
alsoumahi alBatal
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many databases support temporary tables or arrays of some sort.


thanks for reply , can you give me some links or examples how can I use temporary tables or arrays

thanks
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alsoumahi alBatal wrote:can you give me some links or examples how can I use temporary tables or arrays


You said you were using MySQL? Then your google search keywords would be mysql temporary table. When I tried that, I was given numerous links about MySQL and temporary tables. You should try this Google search technology, it works really well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic