Im almost done with a procedure i started yesterday, but on the last step i have found a problem that happens only if a comparison is done with an if clause. The procedure shows all the information of a match if you introduce a football league round and the name of a team. Im storing the football match id on idp for later comparisons when the team is either the home or the away team and the date matches with one of the two rounds available (the if clause sets a different date to a variable called FECHA if it is either one or two). The thing is that, if i try to check the FECHA or date in spanish manually, it works, but if i try using the if path, an error appears claiming:
Could you help me solve that? Thank you so much!
create or replace PROCEDURE COMPROBARPARTIDO(JORNADA IN NUMBER, EQUIPO IN VARCHAR2) AS
FECHA DATE;
IDLOCAL NUMBER;
IDP NUMBER;
NUMAUX NUMBER;
NUMAUX2 NUMBER;
GOLAUX NUMBER;
GOLOC NUMBER;
GOLVI NUMBER;
BEGIN
NUMAUX:=0;
NUMAUX2:=0;
IF JORNADA = 1 THEN
FECHA := TO_DATE('2021-03-04','yyyy-mm-dd');
ELSIF JORNADA = 2 THEN
FECHA := TO_DATE('2021-03-13','yyyy-mm-dd');
ELSE
DBMS_OUTPUT.PUT_LINE('ERROR');
END IF;
SELECT DISTINCT P.ID INTO IDP
FROM PARTIDO P
INNER JOIN EQUIPO EL
ON P.ID_LOCAL =EL.ID
INNER JOIN EQUIPO EV
ON P.ID_VISITANTE = EV.ID
WHERE P.FECHA = FECHA AND (EV.NOMBRE =EQUIPO OR EL.NOMBRE=EQUIPO);