21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Added in: 1.0<br />

DDL statements<br />

Description: Creates or recreates a stored procedure. If a procedure with the same name already exists, RECRE-<br />

ATE PROCEDURE will try to drop it and create a new procedure. RECREATE PROCEDURE will fail if the existing<br />

SP is in use.<br />

Syntax: Exactly the same as CREATE PROCEDURE.<br />

Restriction on recreating used procedures<br />

Changed in: 2.0, 2.0.1<br />

Description: In <strong>Firebird</strong> 2.0 only, a restriction is in place which prevents anyone from dropping, altering or<br />

recreating a trigger or stored procedure if it has been used since the database was opened. This restriction has<br />

been removed again in version 2.0.1. Still, performing these operations on a live database is potentially risky<br />

and should only be done with the utmost care.<br />

CREATE SEQUENCE<br />

Available in: DSQL<br />

Added in: 2.0<br />

SEQUENCE or GENERATOR<br />

Description: Creates a new sequence or generator. SEQUENCE is the SQL-compliant term for what InterBase<br />

and <strong>Firebird</strong> have always called a generator. CREATE SEQUENCE is fully equivalent to CREATE GENERATOR<br />

and is the recommended syntax from <strong>Firebird</strong> 2.0 onward.<br />

Syntax:<br />

Example:<br />

CREATE SEQUENCE sequence-name<br />

create sequence seqtest<br />

Because internally sequences and generators are the same thing, you can freely mix the generator and sequence<br />

syntaxes, even when operating on the same object. This is not recommended however.<br />

Sequences (or generators) are always stored as 64-bit integer values, regardless of the database dialect. However:<br />

• If the client dialect is set to 1, the server passes generator values as truncated 32-bit values to the client.<br />

• If generator values are fed into a 32-bit field or variable, all goes well until the actual value exceeds the 32-bit<br />

range. At that point, a dialect 3 database will raise an error whereas a dialect 1 database will silently truncate<br />

the value (which could also lead to an error, e.g. if the receiving field has a unique key defined on it).<br />

See also: ALTER SEQUENCE, NEXT VALUE FOR, DROP SEQUENCE<br />

34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!