USING SQL AS A CODE GENERATOR (OR 'TEACHING ORACLE TO WRITE SQL SCRIPTS') ABSTRACT Valid SQL statements can be generated from Oracle by embedding SQL syntax, in association with retrieved data, within a "parent" script. The execution of that parent script can itself generate new SQL statements. This is a complex process, particularly when multiple hierarchies of scripts are built into one parent script, combined with the retrieval of attributes used as variables in the "next" embedded script. The technique is powerful and important. It demonstrates the convergence of true set-based processing with sequential processing, entirely within the standard SQL environment. Programming problems can be solved that would otherwise have to be implemented in a host language. Because SQL is still the fundamental means of access to the Oracle database, this sophisticated technique is as relevant to Oracle9i as it has always been to previous versions. This session presents increasingly complex examples while clearly identifying the rules for their successful construction. Peter G Robson Database Administrator