Subject Re: [firebird-support] stored proc and default values
Author Martijn Tonies
Hi,

> With FB 1.0.3, I have a table like that :
> CREATE TABLE CONVIVE (
> CNVIDP INTEGER NOT NULL,
> CNVMATA VARCHAR(20),
> ...
> CNVTICKETL LOGIQUE default 1 NOT NULL,
> );
> LOGIQUE is a domain :
> CREATE DOMAIN LOGIQUE AS
> SMALLINT
> CHECK (value in (0,1) or value is null);
>
> When I'm inserting a new record into CONVIVE, without giving a value
> for CNVTICKETK, there's no problem, the record is inserted with
> CNVTICKETL=1. But, when using the same insert command into a stored
> procedure, I have a SQL Error :
>
> - The insert failed because a column definition includes validation
> constraints.
> validation error for column CNVTICKETL, value "*** null ***
>
> Why did not FB affect 1 to CNVTICKETL ? FB bug or did I misunderstood
> FB behaviors ?

A DEFAULT is not used when you supply NULL, but only
used when you don't include the column in the INSERT INTO
statement.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com