I have the following code:
DECLARE
v_hire_date DATE:='30-Oct-2000';
v_six_years BOOLEAN;
BEGIN
IF MONTHS_BETWEEN(SYSDATE,v_fecha_contrato)/12 > 6 THEN
v_six_years:=TRUE;
ELSE
v_six_years:=FALSE;
END IF;
DBMS_OUTPUT.PUT_LINE('flag '||v_six_years);
END;
I want to print the value of the variable v_six_years
, but I am getting the error:
ORA-06550: line 10, column 24:
PLS-00306: wrong number or types of arguments in call to '||'
ORA-06550: line 10, column 3
How to print the value of the variable v_six_years
?
It seems you cannot concat varchar
and boolean
.
Define this function:
FUNCTION BOOLEAN_TO_CHAR(FLAG IN BOOLEAN)
RETURN VARCHAR2 IS
BEGIN
RETURN
CASE FLAG
WHEN TRUE THEN 'TRUE'
WHEN FALSE THEN 'FALSE'
ELSE 'NULL'
END;
END;
and use it like this:
DBMS_OUTPUT.PUT_LINE('flag '|| BOOLEAN_TO_CHAR(v_six_years));