Using SQL

OK. Get ready. Here’s my soapbox speech. A final word before you start. Don’t make the mistake of becoming dependent on a procedural language and forgetting how to use the set-oriented nature of SQL to solve your programming problems. In other words, make sure you use the full power of SQL. A common example of this phenomenon is the batch updating of data in a table. Often, programmers will create a program using a procedural language such as PL/SQL or Java, open a cursor on a table for a given set of criteria, then walk through the result set row by row, selecting data from another table or tables, and finally updating the original row in the table with the data. However, all this work can be done more quickly and easily using a simple SQL UPDATE statement with a single- or multicolumn subquery.

I can’t emphasize enough how important it is for you to know the SQL language in order to get the most from using JDBC. If you don’t have a lot of experience using SQL, I suggest you read SQL in a Nutshell, by Kevin Kline with Daniel Kline (O’Reilly)or Oracle: The Complete Reference, by George Koch and Kevin Loney (Osborne McGraw-Hill).

Get Java Programming with Oracle JDBC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.