# ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at line 5

**URL:** <https://forums.toadworld.com/t/ora-06502-pl-sql-numeric-or-value-error-character-string-buffer-too-small-ora-06512-at-line-5/58379>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [October 25, 2023, 6:17pm UTC](https://forums.toadworld.com/t/ora-06502-pl-sql-numeric-or-value-error-character-string-buffer-too-small-ora-06512-at-line-5/58379 "2023-10-25T18:17:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [October 25, 2023, 6:31pm UTC](https://forums.toadworld.com/t/ora-06502-pl-sql-numeric-or-value-error-character-string-buffer-too-small-ora-06512-at-line-5/58379/2 "2023-10-25T18:31:33Z")

</div>

If you are running your SQL with the "Execute Script (F5)" button, this is expected because DATE is not a SQL\*Plus variable datatype. You can see that here if I run the SQL with SQL\*Plus. SQL\*Plus doesn't recognize the 'DATE' variable type so it doesn't see the variable at all. Toad creates it as a varchar and throws the error you see (which, admittedly, may be a bug because we should give the same error as SQL\*Plus)

 ![image](https://global.discourse-cdn.com/quest/original/3X/d/6/d6885cce02b8c3eef483835f331801da38e04640.png)

This "Execute Script" method of query/script execution in Toad simulates SQL\*Plus.

Workarounds:

Declare `:MAX_DATE` as a VARCHAR2, and use TO\_CHAR when setting its value.  
Or  
Run the SQL in Toad with "Execute/Compile" instead.

 ![image](https://global.discourse-cdn.com/quest/original/3X/f/d/fde9b70c5c0fe7b12ac1f8a9db2184f9efb91554.png)

The differences between F5 and F9 are detailed in my rant [here](https://forums.toadworld.com/t/editor-f5-execute-as-script-vs-f9-execute-compile/55985). Short version: F9 is almost always the way you should really be running SQL in Toad.

---

_[View the full topic](https://forums.toadworld.com/t/ora-06502-pl-sql-numeric-or-value-error-character-string-buffer-too-small-ora-06512-at-line-5/58379)._
