create or replace view b as
select opentime,closetime,
decode(to_char(closetime),'0000','1440',to_char(to_number(closetime)-to_number(opentime))) inservtime from a
select opentime,closetime,
decode(to_char(closetime),'0000','1440',to_char(to_number(closetime)-to_number(opentime))) inservtime from a
CLOSETIME,
(CASE
WHEN CLOSETIME = '0000' THEN
'1440'
ELSE
TO_CHAR(TO_NUMBER(CLOSETIME) - TO_NUMBER(A.OPERTIME))
END) INSERVTIME
FROM A
CLOSETIME,
DECODE(CLOSETIME,
'0000',
'1440',
TO_CHAR(TO_NUMBER(CLOSETIME) - TO_NUMBER(A.OPERTIME))) INSERVTIME
FROM A