title: Error processing validation. ORA-06502: PL/SQL: numeric or value error: character to number conversion error
body: <p>I have period=3day/week/month , start_date and end_date. When I select start_date for eg. 12-DEC-2013.. then i want to validate an end_date is around start_date + period(3day) + 2day(default).. so end_date will be 16-DEC-2013.. I wrote the code here..    </p>
  
  <pre><code>declare
  
  v_period date;
  
  begin
  
  if :P104_TYPE_PERIOD = 'DAY' then
  v_period  := ((TO_DATE(:P104_START_DATE, 'DD-MON-YYYY')+(nvl(to_number(replace(:P104_COURSE_PERIOD,',', '0'))),0)))+2);
  end if;
  
  if :P104_TYPE_PERIOD = 'WEEK' then
  v_period  := ((TO_DATE(:P104_START_DATE, 'DD-MON-YYYY')+(nvl(to_char(to_number(replace(:P104_COURSE_PERIOD,',', '0'))),0)*7))+2);
  end if;
  
  if :P104_TYPE_PERIOD = 'MONTH' then
  v_period  := ((TO_DATE(:P104_START_DATE, 'DD-MON-YYYY')+(nvl(to_char(to_number(replace(:P104_COURSE_PERIOD,',', '0'))),0)*30))+2);
  end if;
  
  if v_period  &lt; :P104_END_DATE then
  return false;
  end if; 
  end;
  </code></pre>
  
  <p>After I run the page, this message appear:</p>
  
  <pre><code>Error processing validation.
  ORA-06502: PL/SQL: numeric or value error: character to number conversion error
  </code></pre>
  
  <p>Does anyone know how to solve this problem?
  Thanks ahead of time!</p>