#######################################################################
## This file describes how to start up the Oracle-SQL main           ##
## memory interpreter (also called Oracle emulator).                 ##
##                                                                   ##
## The Oracle emulator implements a substantial subset of            ##
## Oracle such that you can expect most of your SQL-commands         ##
## to work. However, as it was developed as a backend to ChronoLog   ##
## those Oracle features not used by ChronoLog may be missing.       ##
## Provided features are:                                            ##
##   - selections, projections, joins, set operations                ##
##   - subqueries                                                    ##
##   - aggregates                                                    ##
##   - order by                                                      ##
##   - cursors                                                       ##
##   - views                                                         ##
##   - built-in functions (greatest, least, trunc, to_number, abs)   ##
##   - sequences                                                     ##
##   - updates                                                       ##
##                                                                   ##
## Questions and remarks can be addressed to 'boehlen@iesd.auc.dk'   ##
##                                                                   ##
## The software comes "as is" without express or implied warranty.   ##
#######################################################################

0) Contents
-----------
  1) Changes to you .cshrc file
  2) Starting up a SQL-interpreter


1) Changes to you .cshrc file
-----------------------------
Add the following to your .cshrc file.

    # Oracle Emulator
    #################
    setenv ORACLE_EMULATOR $HOME/OraEmul

Adjust the path if necessary.  After you have updated the .cshrc file you 
must update your environment.  This can be done by typing

    source ~/.cshrc

into your shell (this may vary if you are not using a C shell).  Another 
possibility is to log out and back in.

The emulator is ready to run now.


2) Starting up a SQL-interpreter
--------------------------------
To start up a SQL interpreter type

  cd $ORACLE_EMULATOR
  pl
  [oracle].

into a shell.  At the Prolog prompt (2 ?-) you have two possibilities.

    sql.

starts up a SQL interpreter.  It prompts with 'SQL> ' and waits for
you to type in Oracle-SQL commands.  A command may be spread over
several lines.  A semicolon immediately followed by a carriage return
marks the end of a command.  The second possibility is to load an
existing database by typing

  sql(xxxx).

If the database xxxx does not yet exist, it will be created on the
fly.  On leaving the SQL interpreter the current database state will
be stored such that it can be reloaded at later sessions.

The file '$ORACLE_EMULATOR/Test/test_data' contains some examples of
SQL commands that are handled by the interpreter.  As the emulator
recognizes a substantial subset of Oracle-SQL you may just start off
by typing in your favorite SQL commands, e.g.,

    select * from cat;
    select count(*) from cat;
    create table x(a number(8));
    insert into x values(7);
    insert into x values(6/5);
    select t1.a, t2.a from x t1, x t2;
    drop table x;
    select table_name from cols order by column_name desc;
    select max(table_name) from cat;
    quit;

Note that 'cat' is a meta table (actually it is a meta view) of
Oracle.  See the Oracle documentation for further information about
meta tables/views.  If you issue the command 'select * from cat', the
emulator lists all available meta table/views (together with all
user-defined tables/views).

Have fun.

Mike
