ORA-06502 error for casting string to number (PL/SQL)
Clash Royale CLAN TAG #URR8PPP ORA-06502 error for casting string to number (PL/SQL) I have variable: suma NUMBER(7,2) := 0; I want to execute the following process: suma := suma+cast(substr(jmbg,i,1) as number)*7; But when I run this process it shows the following error message: ORA-06502: PL/SQL: numeric or value error: character to number conversion error. It has problem with this line, so I have tried run this process with TO_NUMBER functions, but it did the same. How can I convert the substring to number without error message? You have to know the format in which the string represents the number; for example, does the string contain leading or trailing zeros? how many decimal digits, what is the decimal separator?, ... Once you know these things, we can find the appropriate format mask to use the to_number – Aleksej 56 mins ago ...