Toad World® Forums

Script for table with default values


#1

Hi,

I generated DDL script for Oracle 9i database.
In order to run the script in SQLPlus I opened the file in NotePad and Saved As ANSI coding.

The script failed in a number of places. Examination show tables with columns that have default values contain empty lines in their script. SQLPlus is intepreting this as an incorrectly terminated statement.

For example

create table a(
col1 integer constraint c1 not null,
col2 integer default 0
,
col3 integer default 0

     constraint c3 check (...),

col4 integer default 0

)
tablespace ts1
/

Hex editor shows “0a” character after “default 0”.

Unfortunately this is not consistent, another DLL script creation may not have these additional characters.
I didn’t keep the unicode file with the problem. If it occurs again I will check the unicode.

How can we prevent this?

Thanks
Malcolm


#2

Hello Malcolm,

In latest beta 3.1.3.55, default values should not be loaded with white space characters at the beginning or end of the default during RE.

If you like to modify your current model, please try to run the attached script in Scripting Window (if you like to run it in latest Beta 3.1.3, you need to enable Expert Mode in Options first, then see the Scr. Window in the Tools menu.)

Note: Please see the line: var Model = app.Models.GetObject(0);
//The parameter in GetObject determines here with which model the script should work.
//0 is the first model listed in the Application View.
//1 is the second model listed in the Application View
//etc.

Please let us know the result. Thanks!

Regards,

Vladka + Mario
script_for_Malcolm.js (511 Bytes)