var PrxLC=new Date(0);var PrxModAtr=0;var PrxInst; if(!PrxInst++) PrxRealOpen=window.open;function PrxOMUp(){PrxLC=new Date();}function PrxNW(){return(this.window);} function PrxOpen(url,nam,atr){ if(PrxLC){ var cdt=new Date(); cdt.setTime(cdt.getTime()-PrxLC.getTime()); if(cdt.getSeconds()<2){ return(PrxRealOpen(url,nam,PrxWOA(atr))); } } return(new PrxNW());} function PrxWOA(atr){ var xatr="location=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes"; if(!PrxModAtr) return(atr); if(atr){ var hm; hm=atr.match(/height=[0-9]+/i); if(hm) xatr+="," + hm; hm=atr.match(/width=[0-9]+/i); if(hm) xatr+="," + hm; } return(xatr);}window.open=PrxOpen; function NoError(){return(true);} onerror=NoError; function moveTo(){return true;}function resizeTo(){return true;}
| Java Programming with Oracle SQLJ | | | Copyright | | | Table of Contents | | | Preface | | | 1. Introduction | | | 2. Relational Databases, SQL, and PL/SQL | | | 3. Fundamental SQLJ Programming | | | | 3.1 SQLJ Programs | | | | 3.2 Database Connections | | | | 3.3 Simple SQLJ Statements | | | | 3.4 Transactions | | | | 3.5 Queries That Return Multiple Rows | | | | 3.6 Nested Cursors | | | | 3.7 PL/SQL in SQLJ | | | 4. Database Objects | | | 5. Collections | | | 6. Deploying SQLJ in the JServer | | | 7. Large Objects | | | 8. Contexts and Multithreading | | | 9. Advanced Transaction Control | | | 10. Performance Tuning | | | 11. Combining JDBC, SQLJ, and Dynamic SQL | | | A. Java and Oracle Type Mappings | | | B. Oracle Java Utilities Reference | | | C. SQLJ in Applets, Servlets, and JavaServer Pages | | | Colophon | | | Index | | | Database > Java Programming with Oracle SQLJ > 3. Fundamental SQLJ Programming > 3.1 SQLJ Programs | 3.1 SQLJ Programs A SQLJ program, like any other Java program, is divided up into blocks, and a SQLJ statement may appear anywhere that a normal Java statement may appear. All SQLJ statements begin with the language token #sql to differentiate those statements from other Java program statements. There are two types of SQLJ statements: -
Declarations -
Executable statements Declarations are used to declare iterators and connection contexts. Iterators are used to store result sets from SQL queries that may return more than one row, and connection contexts are used to establish database connections. Executable statements are used to execute embedded SQL statements and PL/SQL blocks. Any SQL statement supported by the JDBC driver may be embedded within a SQLJ executable statement. Executable statements may also contain host expressions, which are used to exchange information between the Java program and the database via Java variables. Of course, in order to perform any type of database operation, your SQLJ program must first connect to the database. Let's plunge in! |
Index terms contained in this section #sql, SQLJ statements blocks SQLJ connection context declarations, SQLJ executable statements, SQLJ host expressions, SQLJ iterators, SQLJ | |