Skip navigation links
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
12c (12.2.1.2.0)

E76725-01

Package oracle.javatools.db.datatypes

Classes related to datatypes in the database API.

See: Description

Package oracle.javatools.db.datatypes Description

Classes related to datatypes in the database API. DataType definitions are DBObjects, and are retrieved from a DBObjectProvider using the listDataTypes and getDataType methods. For ComplexType objects the listObjects and getObject methods should be used with their type string ComplexType.TYPE.

Related Documentation

When a datatype is used, for example in a column, the information about it is encapsulated in a DataTypeUsage object. This includes the ID of the datatype, as well as any attributes associated with its use (e.g. size, scale, precision etc). For more information see DataTypeUsage. In general when using DataType and DataTypeUsage objects, the DataTypeHelper class provides a lot of useful helper methods.

Examples

A Column's DataTypeUsage

Getting the size for a varchar2 column:
  final Column ename = table.getColumn( "ENAME" );
  final DataTypeUsage datatypeUsage = ename.getDataTypeUsage();
  final Long size = DataTypeHelper.getLongAttributeValue(
                                         datatypeUsage,
                                         DataTypeAttribute.DATATYPE_SIZE );

Creating a DataTypeUsage

Creating a VARCHAR2 column of size 30:
  final DataType datatype = provider.getDataType( "VARCHAR2" );
  final DataTypeUsage datatypeUsage = datatype.createDefaultUsage();
  datatypeUsage.putAttributeValue( DataTypeAttribute.DATATYPE_SIZE,
                                   30L );
See Also:
oracle.javatools.db
Skip navigation links
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
12c (12.2.1.2.0)

E76725-01

Copyright © 1997, 2016, Oracle. All rights reserved.