SQL*PLus script for running external scripts

From: Álvaro G. Vicario <alvaro.NOSPAMTHANX_at_demogracia.com>
Date: Mon, 09 Feb 2009 14:09:01 +0100
Message-ID: <gmp9tg$7jm$1_at_nntp.motzarella.org>



I have a collection of text files where I've been writing down the code to create and populate my app's database objects. A typical file looks like this:

/*

  • Test table - test.sql */ CREATE TABLE TEST ( TEST_ID NUMBER NOT NULL ENABLE, NAME VARCHAR2(50),
        CONSTRAINT TEST_PK PRIMARY KEY (TEST_ID) );

COMMENT ON TABLE TEST IS 'Test table';

  • Name is unique ALTER TABLE TEST ADD CONSTRAINT TEST_UK1 UNIQUE (NAME) ENABLE;
There're a lot of files and they need to be run in a specific order so I'm trying to compose a SQL*Plus script to run them all. But I've never worked with SQL*Plus before and I can't grasp the basics from the official manuals.

Apparently, I need to use the _at_@ operator [1]. It does indeed run the external files, but I get a syntax error on every line: it seems to be expecting single-line commands. The manual mentions the need to run "SET SQLTERMINATOR" [2] but I can't figure out how.

I'd appreciate some help to get started. I'm running these tests in a local installation of Oracle Database 10g Express Edition Release 10.2.0.1.0.

[1]
http://download-west.oracle.com/docs/cd/B12037_01/server.101/b12170/ch13.htm#i2696759 [2]
http://download-west.oracle.com/docs/cd/B12037_01/server.101/b12170/ch13.htm#i2498515

--

Received on Mon Feb 09 2009 - 07:09:01 CST

Original text of this message