cast an interval type to integer or char example needed

Database
Fan

cast an interval type to integer or char example needed

i need to cast a INTERVAL Day to Second(2) attribute to either  int or char.   Anyone have an example.  I cannot find one in the ref manuals. 

2 REPLIES
Senior Apprentice

Re: cast an interval type to integer or char example needed

Cast to char is easy: cast(interval '123 12:34:56.78' day to second as char(17))

But what result do you want for a cast to int?

012312345678? Or the number of seconds like 10672496.21?

Fan

Re: cast an interval type to integer or char example needed

Tanks Dieter, but some clarification.   I want to change an existing column (Elapsedtime) which is Interval day to second(2) into another form that I can use  for  grouping like how many < 1min, < 3min,,ect  

This statement gives me invaild operation for date or time interval

select cast( ElapsedTime as integer)   or

select cast( ElapsedTime as char(17))