ࡱ> gifM _bjbj== WW[l       44444,`l4 ~(,i k k k k k k $h         i i    i  X*044T 5 i 0 = ,hj jhi 44    Virtual Spreadsheets and Upsert Through SQL Interrow Calculations Many of you may not be familiar with the SPREADSHEET XE "SPREADSHEET"  functionality within Oracle. In Oracle Database 10g, Oracle provides the capability to do spreadsheet-like array calculations within the Oracle SQL domain. The benefits of the SPREADSHEET (or MODEL Clause if you prefer) are many. Now, Oracle Database 10g queries and subqueries can include new syntax that provides highly expressive spreadsheet-like array computations with enterprise-level scalability. The computations treat relational tables as n-dimensional arrays, allowing complex computations while avoiding the performance problems of multiple joins and unions. You can use these spreadsheet computations on relational tables and also in Oracle OLAP analytic workspaces. Benefits Of MODELs (SPREADSHEETS) No one will argue that spreadsheets are a terrific personal productivity tool that can be used to build (sometimes overly) complex models. But we all know what happens when the number of formulas and the amount of data becomes large; the spreadsheet soon becomes unwieldy and impossible to use. In addition, desktop spreadsheets have no access to the parallel processing abilities of advanced servers. Also, in a collaborative enterprise setting where many spreadsheets may be in use, it is difficult, if not impossible, to overview a business by querying and consolidating multiple spreadsheets. The Oracle Database 10g server solves these problems by introducing spreadsheet-like array computations into SQL, using either the ANSI standard MODEL clause or Oracle's SPREADSHEET clause. Using the SQL SPREADSHEET clause, you can perform spreadsheet computations directly in the SQL language. The SPREADSHEET clause offers the capabilities of: Symbolic cell addressing Symbolic array computation UPSERT/UPDATE per rule Looping constructs Ordered computations Reference spreadsheets Automatic rule ordering Recursive model solving Materialized view support Now, let's look at the SQL syntax itself. SQL SELECT Syntax Additions for Spreadsheets The SQL interrow calculation feature is used within the spread_sheet XE "spread_sheet"  clause of the SELECT statement. A very simplified syntax for the SELECT statement using the spread_sheet clause is: SELECT