db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: ij problem?
Date Wed, 07 Dec 2005 10:25:02 GMT
>>>>>>>>>>>> Lars Clausen wrote (2005-12-07 09:46:40):
> On tir, 2005-12-06 at 22:33, Bernt M. Johnsen wrote:
> > >>>>>>>>>>>> Craig L Russell wrote (2005-12-06
10:31:57):
> > > Hi Joe,
> > > 
> > > I think your problem is that VARCHAR needs a length, so the ")" in  
> > > the "user_password VARCHAR)" (at position 161) was unexpected. It  
> > > expected (20) before the closing ")".
> > 
> > For the record: VARCHAR without length is a non-standard feature
> > allowed by some databases. Derby requires length and is thus compliant
> > with the SQL standards (all of them).
> 
> Is that length used for anything?  Surely it doesn't allocate all that
> anyway, so is it just for compliance?

The length of VARCHAR is the *maximum* size of that string. It is a
constraint on the type of the field and any reasonable database would
allocate just the characters you use (or optimize storage in a
reasonable way). 

If you don't need this constraint, you may use VARCHAR(32672) for
"indefinite". 32672 is the largest value you can use in Derby
varchars.

Note that this limit will vary between databases so for portability
reasons you should select what't meaningful for your application, not
the largest possible value.

-- 
Bernt Marius Johnsen, Database Technology Group, 
Sun Microsystems, Trondheim, Norway

Mime
View raw message