Google
 

Kamis, 05 Juli 2007

Nice Function Added in Firebird 2.1 (beta)

Here is the list of built in function in Firebird 2.1 (now, it's still beta). My favourite function:

String function: LPAD, RPAD, LEFT, RIGHT, POSITION, REPLACE, REVERSE

Date function: DATEDIFF, DATEADD

Numeric function: ROUND, TRUNC, ABS, MIN_VALUE, MAX_VALUE, GEN_UUID, HASH

So with this new built in function, my previous article can be achieve with more short statement like this:

select current_date,
right(extract(year from current_date), 2) ||
right('0' || extract(month from current_date), 2) as Year_Month
from rdb$database

But in my opinion it would be nice if Firebird team extend the capability of SUBSTRING function like this: the "length" value can be negative so it can achieve the same result like RIGHT function with the capability of "start position". Example:

Substring('Hello World' from 9 to -3) will result "Wor"

Tidak ada komentar: