Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

4096 character limit on single SELECT statement?

699319May 1 2009 — edited Oct 1 2013
Hi,
Is there a limit on the length of SQL statements that Oracle can handle?

I am using java Statement class to execute an sql query.
I always get correct result set as long as my query stays under 4096 characters.
But if my sql query is longer than 4096, then the ResultSet is empty.
Note that there are no exceptions being thrown by executeQuery when this happens, just an empty set gets returned.

String sql = "SELECT FROM ... very long IN clause";
java.sql.Statement stmt = DBUtilities.getConnection(txn).createStatement();
ResultSet set = stmt.executeQuery(sql);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 29 2013
Added on May 1 2009
7 comments
3,789 views