Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to create a table in a script?

Re: How to create a table in a script?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 4 May 1999 18:59:54 +0200
Message-ID: <925837062.21916.0.muttley.d4ee154e@news.demon.nl>


Hi Arno
The input message is a 'feature' of sqlplus that exists already for several years. There needs to be a carriage return after your ; or / otherwise you will get this warning.
You should be able to process create and alter statements in pl/sql by using the dbms_sql package
sample code
cur_handle integer;
feedback integer;
sqlstr varchar2(1000);
begin
cur_handle := dbms_sql.open_cursor;
sqlstr := 'create......';
dbms_sql.parse(cur_handle, sqlstr, dbms_sql.native); dbms_sql.close_cursor(cur_handle);

Oracle 8 seems to have a separate procedure for this.

Hth,
Sybrand Bakker, Oracle DBA

Arno van Rossum wrote in message <372F18F7.EE1B8FF9_at_mmp-obec.nl>...
>Hello all,
>
>This may be an easy question (I hope so :-) but I can't find the answer.
>We used to use MS SQL server and a script to recreate all our tables in
>a the database.
>
>Now we've switched to oracle and I've converted all ms-sql to oracle
>understandable sql-statements. All works fine when i run the create
>statements one by one, but I would like to use a script or batch file to
>create all tables, stored procedures and constraints.
>
>I've put them all in one file, separated by ; but then sql*plus doesn't
>create all tables saying "input to long" or something alike. (All buffer
>settings in the enviremont of sql*plus are at the max.) Then I tried
>pl/sql, but that doesn't work either. Documentation says you can't use
>create and alter within pl/sql.
>
>Does anyone know an simple (easy :-) way how to do this?
>
>Thanks
>
>Arno van Rossum
>a.van.rossum_at_mmp-obec.nl
Received on Tue May 04 1999 - 11:59:54 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US