0

I have a problem with this code:

select pick_id 
into pickid 
from prov_adapter_pmonitor 
where pick_id = 1;

select count(*) 
into no_of_picks 
from prov_adapter_pmonitor;

WHILE pickid < no_of_picks
loop
    SELECT pick_end_time
    INTO ts1
    FROM prov_adapter_pmonitor
    WHERE pick_id=pickid
    AND count  > 0;

    SELECT pick_start_time
    INTO ts2
    FROM prov_adapter_pmonitor
    WHERE pick_id=pickid+1;

    SELECT TIMESTAMPDIFF(SECOND,ts2,ts1) from prov_adapter_pmonitor;
    select count into cnt from prov_adapter_pmonitor where pick_id=pickid;

    rslt := rslt+diff;
    cnt1 :=cnt1+cnt;

   pickid  :=pickid       +1;

end loop;

I want diff interms of millisec of my two timestamps ts1 and ts2 ,these timestamps are there in my entity, but it is giving exception at third select statement

Please give me any idea regarding this

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
mqsuresh
  • 5
  • 4

1 Answers1

1

It looks like you are mixing mysql and oracle syntax. I think what you need is EXTRACT

select extract(second from (ts2 - ts1)) as diff from dual;
Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78