aspose file tools*
The moose likes JDBC and the fly likes query consisting of if statements, looping, cases on mysql? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "query consisting of if statements, looping, cases on mysql?" Watch "query consisting of if statements, looping, cases on mysql?" New topic
Author

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

alsoumahi alBatal
Ranch Hand

Joined: Nov 22, 2009
Posts: 94
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

Joined: May 26, 2003
Posts: 30938
    
158

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.)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

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

Joined: Nov 22, 2009
Posts: 94

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

Joined: Nov 22, 2009
Posts: 94
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
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: query consisting of if statements, looping, cases on mysql?