title: ORA-06502: PL/SQL: numeric or value error ~ for all STRING values
body: <p>I encountered error </p>
  
  <blockquote>
    <p>ORA-06502: PL/SQL: numeric or value error at FETCH INTO (last line at
    below FUNCTION ).</p>
  </blockquote>
  
  <p>I understand that this error may happen due to type mismatch of data in the cursor and its row type.</p>
  
  <p>But if you see the screenshot (<code>definition of HQP_IF_DATA_CONV_EXTRACT</code> and 1 record that is going to be inserted), everything looks ok. </p>
  
  <p>All are STRING type data and there is no limit exceeded.</p>
  
  <p>Is there any better idea, otherwise how to troubleshoot further?</p>
  
  <pre><code>  FUNCTION INSERT_INTO_BU_STAGING(p_sql IN VARCHAR2)
    RETURN VARCHAR2
    IS
    TYPE refCursor IS REF CURSOR; -- define weak REF CURSOR type
    a_cursor refCursor;
    rec HPQ_IF_DATA_CONV_EXTRACT_BU%ROWTYPE;
  
    j NUMBER;
  
    BEGIN
    j := 0;
  
      OPEN a_cursor FOR p_sql;
      LOOP
        FETCH a_cursor INTO rec;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/k3MnG.png" alt="table and record to be inserted"></p>