Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / July 2007

Tip: Looking for answers? Try searching our database.

Oracle JDBC PreparedStatements

Thread view: 
dweesie - 03 Jul 2007 02:00 GMT
Is it possible to do something like this in Oracle 10g, ojdbc14.jar?
I can't seem to get any results back.  It's fine if I loop through
each item and use " my_column = ?", but I'm not able to use Oracle's
sorting.

String sql = "select * from my_table where my_column in (?) order by
other_column";
OraclePreparedStatement pstmt =
(OraclePreparedStatement)conn.prepareStatement(sql);
String sList = " 'item1','item2','item3' ";
pstmt.setFixedChar(1, sList);
ResultSet rslt = pstmt.executeQuery();
joeNOSPAM@BEA.com - 03 Jul 2007 04:27 GMT
> Is it possible to do something like this in Oracle 10g, ojdbc14.jar?
> I can't seem to get any results back.  It's fine if I loop through
[quoted text clipped - 8 lines]
> pstmt.setFixedChar(1, sList);
> ResultSet rslt = pstmt.executeQuery();

Nope. The semantics of parameters are specific and constrained. They
are precisely one data value each. The prepared statement is
associated
with a precompiled query plan in the DBMS, and such plans cannot
typically
be created with general gaps in their semantics.

Joe Weinstein at BEA Systems
dweesie - 03 Jul 2007 15:02 GMT


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.