Sunday, July 24, 2011

ORA-06502: PL/SQL: numeric or value error: host bind array too small

i got this error when i used dbms_output.put_line and passed a string of more than 255 characters. in order to get rid of this error, following could be used

 PROCEDURE print_ln (p_msg VARCHAR2) IS
    l_loops NUMBER;
 BEGIN
    l_loops := FLOOR(LENGTH(p_msg)/250);
    IF MOD (LENGTH(p_msg),250) > 0
    THEN
       l_loops := l_loops + 1;
    END IF;
    FOR i in 1..l_loops
    LOOP
       DBMS_OUTPUT.PUT_LINE(substr(p_msg,(i-1)*250+1,250));
    END LOOP;
 END;

No comments:

Post a Comment