eu estou com o seuginte problema
eu estou usando o seguinte select
select y.nome
, horas_prev
, horas_trab
, saldo
, TOTAL
from (select x.nome
, rpad(pk_hora.fkg_masc_hora_hora(pk_hora.fkg_min_hora(x.hrs_prev)), 10) horas_prev
, rpad(pk_hora.fkg_masc_hora_hora(pk_hora.fkg_min_hora(x.hrs_trab)), 10) horas_trab
, rpad(pk_hora.fkg_masc_hora_hora(pk_hora.fkg_min_hora((hrs_trab - hrs_prev))), 10) saldo
, rpad(decode(lead(x.nome, 1) over (order by nome), null, sum(hrs_trab) over (order by nome)), 10) TOTAL
, decode(lead(x.nome, 1) over (order by nome), null, 'F') final
from (select us.nome
, pk_soff9082.fkg_horas_prev_period(to_date('01/05/2008', 'dd/mm/yyyy'), to_date('31/05/2008', 'dd/mm/yyyy')) hrs_prev
, sum(hr_fim - hr_ini) hrs_trab
from sf_apont_diario sa
, usu us
where us.usu_id = sa.usu_id
and sa.usu_id in (395, 226)
and dia >= to_date('01/05/2008', 'dd/mm/yyyy')
and dia <= to_date('31/05/2008', 'dd/mm/yyyy')
group by us.nome) x
) y
NOME HORAS_PREV HORAS_TRAB SALDO TOTAL
------------------------------------------------------------ ---------- ---------- ---------- ----------
DESENVCNBR 170:00 170:00 0:00
LUCAS SAMPAIO DE SOUZA 170:00 169:14 -0:46 20354
o resultado ficaria deste modo
NOME HORAS_PREV HORAS_TRAB SALDO
------------------------------------------------------------ ---------- ---------- ----------
DESENVCNBR 170:00 170:00 0:00
LUCAS SAMPAIO DE SOUZA 170:00 169:14 -0:46
---------
20354
Obrigado...