Shahin P
Shahin P

Reputation: 367

How to resolve this error Ora-25137 "Data Value Out of range" in oracle

How to resolve this error

ORA-25137: Data Value out of range
Cause: value from CAST operand is larger than CAST target size
Action: Increase size of CAST target.

Inside CAST I used one column value having datatype length 18 and then after compute again I used another CAST to convert its Datatype having same length 18 but after execute I got an error as I mentioned above. Here is the code:

CAST((CAST(col1 as number(18,0)) * 100)/col2 as varchar(18))

How to resolve this error?

Upvotes: 1

Views: 11951

Answers (2)

Vinko
Vinko

Reputation: 1

You might need to round your inner CAST, ROUND(CAST(col1 as number(18,0)) * 100)/col2, <#of decimal places>) so the whole thing doesn't exceed what varchar(18) can accommodate, or increase your 18 in varchar(18) to a bigger value.

Upvotes: 0

Needle file
Needle file

Reputation: 518

try

as varchar2(18 char)

because varchar(18) means 18 bytes.

Upvotes: 1

Related Questions