I have a question about sql. I use jDeveloper and oracle sql developer.
I wanna make search case insesitive and I wrote like this:
String word = jTextField5.getText();
ResultSet rs = statement.executeQuery("SELECT NAMES, AUTHOR, ID FROM BOOKS WHERE NAMES LIKE '%"+word+"%' OR AUTHOR LIKE '%"+word+"%' COLLATE Latin1_General_CS_AS ");
but I got error: java.sql.SQLException: ORA-00933: SQL command not properly ended
what should I do to solve this problem. By the way I'm new in SQL.
COLLATE Latin1_General_CS_AS
isn't an oracle syntax thing, it looks like a sql server thing
your basic sql could be:
ResultSet rs = statement.executeQuery("SELECT NAMES, AUTHOR, ID FROM BOOKS WHERE upper(NAMES) LIKE upper('%"+word+"%') OR upper(AUTHOR) LIKE upper('%"+word+"%') ");
but this is a full table/full index scan regardless, so won't be fast. for fast string searches, Oracle has oracle text. i'd suggest you read into that and implement a text index if you need to do these type of unbounded searches (on large tables).