0

I look at a oracle database and there is a column named score it is declared as INT(12,2).

The values that are stored there look like this:
23487.31
0
322.3

So does it mean those are actual float values?
I really crawled through the oracle data type documentation but couldn't find any information regarding the notation of INT(a,b).
(Source: https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT012)

Edit: SELECT * FROM v$version; gives me:

Oracle Database 10g Release 10.2.0.5.0 - Production
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
7
  • 3
    Oracle doesn't let you create a table with a column defined as int(12,2). int doesn't take arguments. Are you sure you're seeing INT rather then NUMBER; and if so, where is that being shown? Commented Oct 15, 2018 at 10:50
  • 2
    To reiterate what @AlexPoole said - you can't supply a scale or precision when defining a column of type INT. It's simply not allowed, and provokes an ORA-00907: missing right parenthesis error. dbfiddle here If you have a database where a column is defined as INT(12,2) it's not Oracle. Are you referring to the main-line Oracle product, or one of their other products such as MySQL or Rdb? (MySQL won't even allow this. Can't check Rdb as I don't have access to an Rdb server anymore, but I doubt it will work). Commented Oct 15, 2018 at 11:09
  • @AlexPoole I got the INT(12,2) from DESCRIBE MYTABLE. And yes it is a Oracle 10g. I updated my question for more details. Commented Oct 15, 2018 at 11:45
  • In Oracle DESCRIBE MYTABLE would should show INTEGER not INT. Unless there was a peculiar aberration in 10.2.0.5. Commented Oct 15, 2018 at 13:38
  • 1
    @Peter - in which client, and which version of DB and client? What do you see for the data type, precision and scale in all_tab_columns? Commented Oct 16, 2018 at 16:39

1 Answer 1

2

So does it mean those are actual float values?

No. Those are numbers with a defined precision of two decimal places.

Oracle supports a FLOAT datatype but it is represented internally as NUMBER. If you want genuine floating-point operations for faster arithmetic it has BINARY_FLOAT and BINARY_DOUBLE.


why can't I find anything about the notation of INT(a,b)?

Because it's not valid Oracle notation. INT is allowed as a synonym of INTEGER, but it doesn't permit scale or precision parameters. If you try to include them Oracle hurls ORA-00907. (The precision would be nugatory anyway, because an integer can have a precision of zero.)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer, why can't I find anything about the notation of INT(a,b)? Do you have an idea about that? Or do you have any source for that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.