Type casting as the name implies gives you the ability to translate between diferent types, for example timestamp types as date or time types. Also you can translate timestamp as char or varchar types. For example:
select cast (timestmp as varchar(22)) as Datetxt from RDB$DATABASE
It produces something like this:
2004-06-25 12:15:45.2345
Now the timestamp is a string. Other uses could be when you want to check for an specific date but you have the HH:NN:SS format in the timestamp field, you could do something like this.
select field_col from RDB$DATABASE where cast (timestmp_col as date)= 10/12/2006
Isn’t that cool?, of course you can do the opposite if you want to compare only the time.
select field_col from RDB$DATABASE where cast (timestmp_col as time)= 10:12:20
also it’s useful to check from a date variable.
select field_col from RDB$DATABASE where time_col = cast (time_stamp as date);
As you can see type casting is very very nice and this is just the start. By the way for this examples I’m using dialect 3.