Witam
Mam problem z funkcją
CREATE OR REPLACE FUNCTION 002.GET_YEAR (P_DATE IN DATE)
RETURN VARCHAR2
IS
DECLARE
v_Date VARCHAR2;
BEGIN
select to_char(MAX(to_date(actual_date,'YYYY-MM-DD')),'YYYYMMDD') as ACTUAL_DATE
INTO v_Date FROM (select distinct actual_date from MXI3_T_TRADES_RAW);
IF P_DATE IS NULL THEN
RETURN NULL;
ELSIF v_Date > P_DATE THEN
TO_CHAR(v_DATE, 'YYYYMMDD');
ELSE
TO_CHAR(P_DATE, 'YYYYMMDD');
END IF;
END GET_YEAR;
Dostaje błąd:
PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following:
begin function pragma procedure subtype type <an identifier="identifier">
current cursor delete
exists prior external language
The symbol "begin" was substituted for "DECLARE" to continue.
Compile error at line 4, column 3
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
;
Compile error at line 16, column 24