0

I want to basically have an "id" type in Oracle.

An example which would satisfy my needs would be a 32/64 bit integer where NULL is represented as -INT_MIN.

I don't need this to be variable length (like NUMBER). I considered using RAW but I don't believe there is an implicit conversion from RAW to integers.

It seems an option is BINARY_DOUBLE. Is this the best approach?

2 Answers 2

3

Use NUMBER(10, 0), which is equivalent to NUMBER(10). BINARY_DOUBLE is a floating-point representation, not an integer. I figure, don't second-guess the database, unless you have a specific reason to do so. You may be talking yourself out of behind the scenes data optimizations that the CBO can do (though I don't know if there are any). You say you want an integer, so use an integer.

And why would you want to represent NULL as -INT_MIN? Represent NULL as NULL.

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

Comments

0

Not sure of your entire requirement, but yes it appears you're correct:

http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i16209

Comments

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.