PL/SQL Error 06502 with ODAC 9.7.28.0
Posted: Tue 29 Nov 2016 09:54
Hello,
since upgrading to ODAC 9.7.28.0 we are experiencing PL/SQL-Error 06502
No change to our SQL-statements was made.
The same code executes without error when using ODAC 9.7.26.0
We are compiling with RAD Studio Berlin 10.1 Update 2
Our Oracle database is 11g Version 11.2.0.4.0 64bit
We are connecting to the database in direct mode.
The full Oracle error message is in German as follows:
ORA-06502: PL/SQL: numerischer oder Wertefehler: Zeichenfolgenpuffer zu klein
ORA-06512: in Zeile 19
It seems to be caused by Parameter-conversion ".asString"
We also encounter the same error when using ".asFloat"
The Database-field "VKKL_ID" is of type "NUMBER"
A sample SQL-Statement Delphi source code is as follows (it happens with many other similar statements):
SVKKL := TOraSQL.Create(nil);
try // 1
SVKKL.session := OraSession;
SVKKL.SQL.Add ( 'DECLARE ' );
SVKKL.SQL.Add ( ' oVKKL verkaufskladde%ROWTYPE; ' );
SVKKL.SQL.Add ( ' vbenu_id benutzer.benu_id%TYPE; ' );
SVKKL.SQL.Add ( 'BEGIN ' );
SVKKL.SQL.Add ( 'select benu_id into vbenu_id from benutzer ' );
SVKKL.SQL.Add ( ' where benu_login = upper(:BENUTZER); ' );
SVKKL.SQL.Add ( 'pck_benutzer.setbenu_id (vbenu_id); ' );
SVKKL.SQL.Add ( 'oVKKL.FEHLERNUMMER := :FEHLERNUMMER; ' );
SVKKL.SQL.Add ( 'oVKKL.FEHLERTEXT := :FEHLERTEXT; ' );
SVKKL.SQL.Add ( 'pck_webshop.initkladde (oVKKL); ' );
SVKKL.SQL.Add ( 'oVKKL.BENUTZER := :BENUTZER; ' );
SVKKL.SQL.Add ( 'oVKKL.KUNDENNR := :KUNDENNR; ' );
SVKKL.SQL.Add ( 'pck_webshop.fuellekladde (oVKKL); ' );
SVKKL.SQL.Add ( 'oVKKL.LIEFERADR := :LIEFERADR; ' );
SVKKL.SQL.Add ( 'pck_webshop.insertkladde (oVKKL); ' );
SVKKL.SQL.Add ( 'COMMIT; ' );
SVKKL.SQL.Add ( ':FEHLERTEXT := oVKKL.FEHLERTEXT; ' );
SVKKL.SQL.Add ( ':FEHLERNUMMER := oVKKL.FEHLERNUMMER; ' ); // Line 18
SVKKL.SQL.Add ( ':SVKKL_ID := oVKKL.VKKL_ID; ' ); // Line 19 this causes Error with ODAC 9.7.28.0
// Executes successfully with ODAC 9.7.26.0
SVKKL.SQL.Add ( 'END; ' );
SVKKL.ParamByName ( 'BENUTZER').AsString := lBenutzer;
SVKKL.ParamByName ( 'KUNDENNR' ).AsString := lKunde;
SVKKL.ParamByName ( 'LIEFERADR' ).AsString := lLieferAdr;
SVKKL.ParamByName ( 'sVKKL_ID' ).AsString := ''; // causes Error
SVKKL.ParamByName ( 'FEHLERTEXT' ).AsString := '';
SVKKL.ParamByName ( 'FEHLERNUMMER' ).AsInteger := 0;
try // 2
SVKKL.Execute; // exception is thrown with above Errormessage
except // 2
We found a workaround, but do not want to analyse hundreds of SQL-statements.
The workaround would be to declare an integer and convert it back to string after execution.
Example:
var iVKKL_ID : int64;
...
// then change Line 19 of SQL to:
SVKKL.SQL.Add ( ':iVKKL_ID := oVKKL.VKKL_ID; ' ); // No Error Version 9.7.28, workaround
...
SVKKL.ParamByName ( 'iVKKL_ID' ).AsLargeInt := iVKKLID; // No Error Version 9.7.28
...
after SVKKL.Excecute extract the field as following:
sVKKLID := SVKKL.ParamByName ('iVKKL_ID' ).AsString; // No Error Version 9.7.28
If you need further information, please let me know.
since upgrading to ODAC 9.7.28.0 we are experiencing PL/SQL-Error 06502
No change to our SQL-statements was made.
The same code executes without error when using ODAC 9.7.26.0
We are compiling with RAD Studio Berlin 10.1 Update 2
Our Oracle database is 11g Version 11.2.0.4.0 64bit
We are connecting to the database in direct mode.
The full Oracle error message is in German as follows:
ORA-06502: PL/SQL: numerischer oder Wertefehler: Zeichenfolgenpuffer zu klein
ORA-06512: in Zeile 19
It seems to be caused by Parameter-conversion ".asString"
We also encounter the same error when using ".asFloat"
The Database-field "VKKL_ID" is of type "NUMBER"
A sample SQL-Statement Delphi source code is as follows (it happens with many other similar statements):
SVKKL := TOraSQL.Create(nil);
try // 1
SVKKL.session := OraSession;
SVKKL.SQL.Add ( 'DECLARE ' );
SVKKL.SQL.Add ( ' oVKKL verkaufskladde%ROWTYPE; ' );
SVKKL.SQL.Add ( ' vbenu_id benutzer.benu_id%TYPE; ' );
SVKKL.SQL.Add ( 'BEGIN ' );
SVKKL.SQL.Add ( 'select benu_id into vbenu_id from benutzer ' );
SVKKL.SQL.Add ( ' where benu_login = upper(:BENUTZER); ' );
SVKKL.SQL.Add ( 'pck_benutzer.setbenu_id (vbenu_id); ' );
SVKKL.SQL.Add ( 'oVKKL.FEHLERNUMMER := :FEHLERNUMMER; ' );
SVKKL.SQL.Add ( 'oVKKL.FEHLERTEXT := :FEHLERTEXT; ' );
SVKKL.SQL.Add ( 'pck_webshop.initkladde (oVKKL); ' );
SVKKL.SQL.Add ( 'oVKKL.BENUTZER := :BENUTZER; ' );
SVKKL.SQL.Add ( 'oVKKL.KUNDENNR := :KUNDENNR; ' );
SVKKL.SQL.Add ( 'pck_webshop.fuellekladde (oVKKL); ' );
SVKKL.SQL.Add ( 'oVKKL.LIEFERADR := :LIEFERADR; ' );
SVKKL.SQL.Add ( 'pck_webshop.insertkladde (oVKKL); ' );
SVKKL.SQL.Add ( 'COMMIT; ' );
SVKKL.SQL.Add ( ':FEHLERTEXT := oVKKL.FEHLERTEXT; ' );
SVKKL.SQL.Add ( ':FEHLERNUMMER := oVKKL.FEHLERNUMMER; ' ); // Line 18
SVKKL.SQL.Add ( ':SVKKL_ID := oVKKL.VKKL_ID; ' ); // Line 19 this causes Error with ODAC 9.7.28.0
// Executes successfully with ODAC 9.7.26.0
SVKKL.SQL.Add ( 'END; ' );
SVKKL.ParamByName ( 'BENUTZER').AsString := lBenutzer;
SVKKL.ParamByName ( 'KUNDENNR' ).AsString := lKunde;
SVKKL.ParamByName ( 'LIEFERADR' ).AsString := lLieferAdr;
SVKKL.ParamByName ( 'sVKKL_ID' ).AsString := ''; // causes Error
SVKKL.ParamByName ( 'FEHLERTEXT' ).AsString := '';
SVKKL.ParamByName ( 'FEHLERNUMMER' ).AsInteger := 0;
try // 2
SVKKL.Execute; // exception is thrown with above Errormessage
except // 2
We found a workaround, but do not want to analyse hundreds of SQL-statements.
The workaround would be to declare an integer and convert it back to string after execution.
Example:
var iVKKL_ID : int64;
...
// then change Line 19 of SQL to:
SVKKL.SQL.Add ( ':iVKKL_ID := oVKKL.VKKL_ID; ' ); // No Error Version 9.7.28, workaround
...
SVKKL.ParamByName ( 'iVKKL_ID' ).AsLargeInt := iVKKLID; // No Error Version 9.7.28
...
after SVKKL.Excecute extract the field as following:
sVKKLID := SVKKL.ParamByName ('iVKKL_ID' ).AsString; // No Error Version 9.7.28
If you need further information, please let me know.