Subject Re: [ib-support] null vs not null field syntax?
Author Claudio Valderrama C.
""rimovm"" <rimovm@...> wrote in message
news:a5l994+823r@......
> Platform: Firebird RC2
>
> Hello all!
>
> Been working to finally getting to the latest firebird, etc, and came
> across some code in a code library that basically issued the
> statement: (pseudocode)
>
> CREATE TABLE(FieldName VARCHAR(80) not null, FieldName2 VARCHAR(30)
> null);
>
> Firebird was dying on the "not null" part of the statement. And
> whoever put it into the code library had the note: "SQL-92 Standard?"

Are you sure??? I see two different things:
- The first field is NOT NULL. This is okay. Beware that IB and FB follow a
strict order of tokens. The default (if any) comes before NOT NULL, the
charset comes before both and the collation goes at the tail.
create table ttt(a char(1) character set iso8859_1 default '' not null
collate es_es);

- The second field reads:
FieldName2 VARCHAR(30) null
Is this a typo? The standard says that "nullable" is the default state. You
will find that IB & FB are annoyingly near the SQL proposal. Gates and
Ellison decided to support "null" in a declaration, but FB doesn't
understand it because this is the only possible default. In MsSql, the
default is not null but they provide a flag for SQL conformance. In Oracle I
don't know. Your second field is
FieldName2 VARCHAR(30)
That's the only problem.

American National Standard X3.135-1992
11.4 <column definition>
Function
Define a column of a table.
Format

<column definition> ::=
<column name> { <data type> 1 <domain name> }
[ <default clause> I
[ <column constraint definition>... ]
[ <collate clause> ]

<column constraint definition> ::=
[ <constraint name definition> I
<column constraint>
[ <constraint attributes> ]

<column constraint> ::=
NOT NULL <====********************************
| <unique specification>
| <references specification>
| <check constraint definition>

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing