Olá Pessoal.
Tenho a seguinte função:
END:
create or replace
FUNCTION getDiaUtil(date in ddata, boolean in bproximo, boolean in bsabado) return date as
vresult date;
isemana integer;
iinc integer;
iresultSelcARQTABE integer;
sdia varchar;
smes varchar;
BEGIN
vresult := ddata;
IF bproximo THEN
iinc := 1;
ELSE
iinc := -1;
END IF;
WHILE TRUE LOOP
SELECT to_number( to_char( vresult, 'D' )) INTO isemana from dual;
IF isemana = 0 THEN
vresult := vresult + iinc;
ELSE IF (bsabado AND isemana = 6) THEN
vresult := vresult + iinc;
ELSE
sdia := extract( DAY FROM vresult);
smes := extract( MONTH FROM vresult );
IF ( sdia < 10 ) THEN
sdia := '0' || sdia;
END IF;
IF ( smes < 10 ) then
smes := '0' || smes;
END IF;
SELECT TABECODI, TABEINDI
INTO iresultSelcARQTABE, TABEINDI
FROM ARQTABE
WHERE TABEINDI = 910 AND TABECODI = sdia || smes;
IF iresultSelcARQTABE IS NOT NULL THEN
vresult := vresult + iinc;
ELSE
EXIT;
END IF;
END IF;
END LOOP; // ERRO
RETURN vresult;
END; // ERRO
O oracle indica 2 erros, um no END LOOP, e outro no último
no primeiro erro: Error(48,9): PLS-00103: Encountered the symbol "LOOP" when expecting one of the following: if
e no segundo : Error(52): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;