Hello,
I'm new to Postgresql and plpgslq. I wrote a plpgsql to return epoch time
from a table, but had problem running it. The error returned:
NOTICE: Error occurred while executing PL/pgSQL function sleeptime
NOTICE: line 10 at assignment
ERROR: Bad timestamp external representation 'rec_runtime.runtime'
My plpgsql function:
create function sleeptime () returns float as '
declare
rec_runtime record;
ret_sleepsecs float;
begin
select into rec_runtime runtime from mon_nextrun order by runtime
limit 1;
if rec_runtime.runtime is null
then
return 60;
end if;
ret_sleepsecs := extract (epoch from timestamp
''rec_runtime.runtime'') as float;
return ret_sleepsecs;
end;
' language 'plpgsql';
What is the correct syntax for extract function in the assignment statement?
Thanks in advance.
-CT