Category : Files from Magazines
Archive   : DBMS0291.ZIP
Filename : MULTISQL.FEB

 
Output of file : MULTISQL.FEB contained in archive : DBMS0291.ZIP


Jan. TechTip Listing 4

REM Milti.SQL
REM
REM Harnessing the power of a Cartesian explosion for peaceful use
REM in ORACLE's SQL*Plus
REM
REM Charles B. Darling
REM Better Business Solutions Inc. Clearwater, FL
REM

REM First, a simple list:

SELECT FirstName, LastName, MailStop, ZIP
FROM Members
ORDER BY ZIP, LastName, FirstName;

REM Next, assemble the materials...

CREATE TABLE Multi (Dummy CHAR(1));

REM place the fuse...

INSERT INTO Multi VALUES ('X');
/* Once for each copy you want */
INSERT INTO Multi VALUES ('X');

REM and strike the spark!

SELECT FirstName, LastName, MailStop, ZIP
FROM Members, Multi
ORDER BY ZIP, LastName, FirstName, Members.ROWID;
/* AA-BB-CC */

REM And once more:

SELECT FirstName, LastName, MailStop, ZIP
FROM Members, Multi
ORDER BY Multi.ROWID, ZIP, LastName, FirstName;
/* ABC-ABC */

REM (* chuckle *)