Subject | Re: [firebird-support] A few questions |
---|---|
Author | Martijn Tonies |
Post date | 2005-12-02T14:07:10Z |
> 1) It appears the check constraint below it not enforced properly. Why ?A Check Constraint is evaluated before every update or insert. If
>
> create table tt ( k numeric(8) , v char(10));
> alter table tt add constraint ck1 check( 3>(select count(*) from tt) );
> insert into table tt(k,v) values (1,'one');
> insert into table tt(k,v) values (2,'two');
> insert into table tt(k,v) values (3,'three');
> This
> insert into table tt(k,v) values (4,'four');
> results in
> "Operation violates CHECK constraint CK1 on view or table TT"
>
> select count(*) from tt;
> count
> ------
> 3
it passes, the statement passes. So in your case, I guess you need
to write CHECK (2 > ( ... ) )
> 2)There are STATEMENT triggers in Firebird ?No, only row level triggers.
>If not, is there a way toWouldn't know how.
> simulate them ?
> 3) How can I retrieve the count of the row affected by the previous DMLIn Firebird 1.5 ( I believe ) and up, use the ROW_COUNT variable.
> statement in a stored procedure ?
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com