编译此函数时收到以下错误:
PROCEDURE INV.USP_MSC_MODIFICA_ESTADO 的编译错误
Error: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternat Line: 14 Text: IF SELECT TRUNC((SYSDATE) -TO_DATE(@FCH_GRABACION, 'DD/MM/YYYY HH24:MI:SS')) From DUAL=1 THEN
CREATE OR REPLACE PROCEDURE "USP_MSC_MODIFICA_ESTADO" AS
BEGIN
DECLARE
CURSOR reservar IS
SELECT
id_reserva,
fch_grabacion
FROM tb_msc_reserva
WHERE to_date(to_char(fch_grabacion, 'dd/mm/yyyy')) = to_date(to_char(SYSDATE, 'dd/mm/yyyy')) - 1;
id_reserva VARCHAR2(50);
fch_grabacion DATE;
BEGIN
OPEN reservar;
FETCH reservar INTO id_reserva, fch_grabacion;
IF SELECT TRUNC((SYSDATE) - TO_DATE(@fch_grabacion, 'DD/MM/YYYY HH24:MI:SS')) FROM dual=1 THEN
UPDATE inv.tb_msc_reserva t
SET t.flg_estado = 'C'
WHERE id_reserva = @id_reserva;
COMMIT;
END if;
WHILE (@@fetch_status = 0)
CLOSE RESERVAR;
END;