Hi, I'm a newbie. I've a problem with iReport. I would do: SELECT DISTINCT Diff_Date(to_date($P{DATA_INI},'DD/MM/YYYY'),to_date($P{DATA_FINE},'DD/MM/YYYY')) FROM TABLE WHERE (DEP = $P{VALORE}) UNION SELECT DISTINCT Diff_Date(to_date($P{DATA_INI},'DD/MM/YYYY'),to_date($P{DATA_FINE},'DD/MM/YYYY')) FROM TABLE But I've an Oracle Error ORA-01858: a non-numeric character war found where a numeric was expected. Diff_Date is a stored procedure and its prototype is: CREATE OR REPLACE FUNCTION Diff_Date (p_d1 in date, p_d2 in date ) return number Where is the problem? If I move WHERE clause in the second SELECT that is: SELECT DISTINCT Diff_Date(to_date($P{DATA_INI},'DD/MM/YYYY'),to_date($P{DATA_FINE},'DD/MM/YYYY')) FROM TABLE UNION SELECT DISTINCT Diff_Date(to_date($P{DATA_INI},'DD/MM/YYYY'),to_date($P{DATA_FINE},'DD/MM/YYYY')) FROM TABLE WHERE (DEP = $P{VALORE}) It work fine. But I must solve the problem in the first case that is a semplification of the real situation. Can you help me? Thank you so much