Обсуждение: Pass age function to extract function

Поиск
Список
Период
Сортировка

Pass age function to extract function

От
Adam Bruss
Дата:

Hello,

 

How can one pass a non string literal interval to the extract function?

 

For example:

 

SELECT starttime, extract(minute from interval testruntime) as runtime from ( select age(endtime, starttime) as testruntime, ref_testnames_serial, starttime, endtime, dense_rank() over (order by starttime desc) dr from dtprfrm764.orion_tests where ref_testnames_serial = 389 and pass = true) x WHERE dr <= 20 ORDER BY starttime asc

 

Does ‘minute from interval’ only accept string literals?

 

Thanks,

Adam

 

Adam Bruss

Development Engineer

AWR Corporation/Simulation Technology & Applied Research

11520 N. Port Washington Rd., Suite 201

Mequon, WI  53092  USA

P: 1.262.240.0291 x104

F: 1.262.240.0294

E: abruss@awrcorp.com

W: http://www.awrcorp.com

 

Re: Pass age function to extract function

От
Rick Genter
Дата:
Try removing the keyword "interval" (i.e., EXTRACT(MINUTE FROM TestRunTime)). Since TestRunTime is a column name, I think if you wanted to cast it as an INTERVAL you'd specify EXTRACT(MINUTE FROM TestRunTime::INTERVAL), but since TestRunTime is already an INTERVAL, the cast is redundant.

On Mon, May 2, 2011 at 4:16 PM, Adam Bruss <abruss@awrcorp.com> wrote:

Hello,

 

How can one pass a non string literal interval to the extract function?

 

For example:

 

SELECT starttime, extract(minute from interval testruntime) as runtime from ( select age(endtime, starttime) as testruntime, ref_testnames_serial, starttime, endtime, dense_rank() over (order by starttime desc) dr from dtprfrm764.orion_tests where ref_testnames_serial = 389 and pass = true) x WHERE dr <= 20 ORDER BY starttime asc

 

Does ‘minute from interval’ only accept string literals?

 

Thanks,

Adam

 

Adam Bruss

Development Engineer

AWR Corporation/Simulation Technology & Applied Research

11520 N. Port Washington Rd., Suite 201

Mequon, WI  53092  USA

P: 1.262.240.0291 x104

F: 1.262.240.0294

E: abruss@awrcorp.com

W: http://www.awrcorp.com

 




--
Rick Genter
rick.genter@gmail.com