Home sql TERADATA: Numeric overflow occurred during computation in LEAST

TERADATA: Numeric overflow occurred during computation in LEAST

Author

Date

Category

Faced an overflow problem when getting the minimum:

Error: [Teradata Database] [TeraJDBC 13.10.00.01] [Error 2616] [SQLState 22003] Numeric overflow occurred during computation.
SQLState: 22003
ErrorCode: 2616

select
     cast (252 as decimal (18,6)) as one
    , cast (9602250000.000000 as decimal (18,6)) as two
    , least (one, two) as resultLeastOne
    , least (cast (252 as decimal (18.6)), cast (9602250000.000000 as decimal (18.6))) as resultLeastTwo
    , least (252, 9602250000.000000) as resultLeastThree

I can’t understand what I don’t like, everything seems to agree with the description
https://teradata.github.io/ presto / docs / current / functions / comparison.html # greatest-and-least


Answer 1

As a result, the working version looks like this:

select
       cast (252 as decimal (18,6)) as one
      , cast (9602250000.000000 as decimal (18,6)) as two
      , td_sysfnlib.least (one, two) as resultLeastOne
      , td_sysfnlib.least (cast (252 as decimal (18.6)), cast (9602250000.000000 as decimal (18.6))) as resultLeastTwo
      , td_sysfnlib.least (252, 9602250000.000000) as resultLeastThree

it is necessary to clarify the system library for functions: td_sysfnlib
Apparently our admins wrote an analogue.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions