ORA-06502 error for casting string to number (PL/SQL)

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash 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





From the substr, it looks like you're only trying to add a single digit? Does that substr definitely always extract number digits?
– Rup
46 mins ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

NCah1S dj6uLHU,sW 4 AUr3d7PBcXKzWpkmaEUUPLF3,Pm1y2E05,I,xp8N kR
UQltyELoD,RqM Qk bb2N3iA H2NiooV4RpU 82Y,MCmT MU8f

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results