I apologize if question title is vague, but I was not able to formulate it better. What I'd like to have is an alternative to TSQL CREATE TYPE
, so I can use it in column definition.
For instance, I need "money" type in Oracle which is technically NUMBER(18,4)
in my system, and each table will have "money" column instead of underlying NUMBER
for consistency purpose. There are some other "types" I'd like to have aliases rather than using them directly.
Unfortunately, I didn't find acceptable solution yet except giving up and using standard types with constraints(or size specification) for each column. The only approach that seems to work is to create OBJECT
type, but it will add unnecessary complexity to the system which I'm trying to avoid.
A very nice Oracle feature, SUBTYPE
, doesn't work in this case . As far as I understand, SUBTYPE
(and subtypes from STANDARD
) creates PL/SQL datatype which cannot be used in SQL. I understand there are various reasons for that.
I wonder what is the best practice for such a problem.
Thank you.
Update
It seems so far that I've listed all possible approaches, and it I'd rather close the question. Not sure if it may be useful for anyone; in case it is, I don't remove the question for the time being.