Dynamic queries in stored procedures - JDBC

Hi,How do we write a query in stored procedures if the field to be selected,conditions & sort order are dynamic?The user selected the columns,conditions & sort order only at run time.Thanks in advance,sundar
[257 byte] By [sundersham] at [2007-9-26 1:34:57]
# 1

The syntax for a stored procedure varies by database. And support for dynamic SQL in a stored proc varies to. And it has nothing to do with java. So you are more likely to get better responses by asking the question on a board/list that is specific to your database and that address stored procedures.

And to get a response here you need to specify the database your are using, and the version might be a good idea too.

And from the design prespective you might keep in mind that dynamic SQL is significantly slower than other forms. And it is also harder to debug and code for. So you might want to consider why you need to do that.

Perhaps you actually want to know how to create dynamic SQL in Java instead?

jschell at 2007-6-29 2:18:43 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Thank you very much, Joe.I'll do the same.
sundersham at 2007-6-29 2:18:43 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...