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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Context variables<br />

else<br />

delete from Customers where custno = :custno;<br />

CURRENT_ROLE always represents a valid role or NONE. If a user connects with a non-existing role, the engine<br />

silently resets it to NONE without returning an error.<br />

Available in: DSQL, PSQL, ESQL<br />

Changed in: 2.0<br />

CURRENT_TIME<br />

Description: CURRENT_TIME returns the current server time. In versions prior to 2.0, the fractional part used to<br />

be always “.0000”, giving an effective precision of 0 decimals. From <strong>Firebird</strong> 2.0 onward you can specify a<br />

precision when polling this variable. The default is still 0 decimals, i.e. seconds precision.<br />

Type: TIME<br />

Syntax:<br />

Examples:<br />

Notes:<br />

CURRENT_TIME [(precision)]<br />

precision ::= 0 | 1 | 2 | 3<br />

The optional precision argument is not supported in ESQL.<br />

select current_time from rdb$database<br />

-- returns e.g. 14:20:19.6170<br />

select current_time(2) from rdb$database<br />

-- returns e.g. 14:20:23.1200<br />

• Unlike CURRENT_TIME, the default precision of CURRENT_TIMESTAMP has changed to 3 decimals. As a<br />

result, CURRENT_TIMESTAMP is no longer the exact sum of CURRENT_DATE and CURRENT_TIME, unless<br />

you explicitly specify a precision.<br />

• Within a PSQL module (procedure, trigger or executable block), the value of CURRENT_TIME will remain<br />

constant every time it is read. If multiple modules call or trigger each other, the value will remain constant<br />

throughout the duration of the outermost module. If you need a progressing value in PSQL (e.g. to measure<br />

time intervals), use 'NOW'.<br />

Available in: DSQL, PSQL, ESQL<br />

CURRENT_TIMESTAMP<br />

110

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

Saved successfully!

Ooh no, something went wrong!