OCI8::Metadata::Column

Column Information

(new in 1.0.0 without rc)

Class Methods

No class methods are declared.

This object is created by the following methods.

Instance Methods

name

column name

type_string

returns column definition as String.

 con = OCI8.new('username/password')
 colinfo = con.describe_table('tab').columns
 colinfo[0].type_string #=> "VARCHAR2(30) NOT NULL"
 colinfo[1].type_string #=> "VARCHAR2(7)"
 colinfo[2].type_string #=> "NUMBER"

data_type

returns data type as Symbol.

Oracle typedata_type
CHAR, NCHAR:char
VARCHAR2, NVARCHAR2:varchar2
RAW:raw
CLOB, NCLOB:clob
BLOB:blob
BFILE:bfile
NUMBER, FLOAT:number
BINARY_FLOAT:binary_float
BINARY_DOUBLE:binary_double
DATE:date
TIMESTAMP:timestamp
TIMESTAMP WITH TIME ZONE:timestamp_tz
TIMESTAMP WITH LOCAL TIME ZONE:timestamp_ltz
INTERVAL YEAR TO MONTH:interval_ym
INTERVAL DAY TO SECOND:interval_ds

charset_form

type of character set(default character set or national character set)

Oracle typechar_form
CHAR(n):implicit
VARCHAR2(n):implicit
CHAR(n CHAR):implicit
VARCHAR2(n CHAR):implicit
NCHAR(n):nchar
NVARCHAR2(n):nchar
Othersnil

nullable?

true if the column value can be null, otherwise false

char_used?

true if the length is counted by number of characters. otherwise false.

Oracle typechar_used?
CHAR(n)false
VARCHAR2(n)false
CHAR(n CHAR)true
VARCHAR2(n CHAR)true
NCHAR(n)true
NVARCHAR2(n)true

char_size

length of character data type. If char_used? is true, the length is counted by characters. If false, it is counted by bytes.

Oracle typechar_size
CHAR(n)n
VARCHAR2(n)n
CHAR(n CHAR)n
VARCHAR2(n CHAR)n
NCHAR(n)n
NVARCHAR2(n)n

data_size

maximum length of data in bytes.

Oracle tyepdata_size
CHAR(n), VARCHAR2(n)n
CHAR(n CHAR), VARCHAR2(n CHAR)n times integer value (4 in my environment)
NCHAR(n), NVARCHAR2(n)n times integer value (2 in my environment)
NUMBER, FLOAT22
BINARY_FLOAT4
BINARY_DOUBLE8
DATE7
TIMESTAMP11
TIMESTAMP WITH TIME ZONE13
TIMESTAMP WITH LOCAL TIME ZONE11

precision

precision of numeric data types. It is radix 10 for NUMBER, radix 2 for FLOAT. A precision for FLOAT become that of NUMBER by multiplying 0.30103. Zero precision means NUMBER whose precision and number are omitted.

Oracle typeprecision
NUMBER0
NUMBER(n)n
NUMBER(m, n)m
FLOAT126
FLOAT(n)n

scale

the number of digits to the right of the decimal point. If precision is not zero and scale is -127, the data type is FLOAT, otherwise NUMBER.

Oracle typescale
NUMBER-127 or 0
NUMBER(n)0
NUMBER(m, n)n
FLOAT-127
FLOAT(n)-127

fsprecision

fractional seconds precision

Oracle typefsprecision
TIMEPTAMP(n)n
TIMESTAMP(n) WITH TIME ZONEn
TIMESTAMP(n) WITH LOCAL TIME ZONEn
INTERVAL DAY(m) TO SECOND(n)n

lfprecision

leading field precision

Oracle typelfprecision
INTERVAL YEAR(n) TO MONTHn
INTERVAL DAY(m) TO SECOND(n)m
Last modified:2007/11/25 18:05:39
Keyword(s):
References:[SideMenu] [ruby-oci8 API] [OCI8::Metadata::Table] [OCI8::Cursor] [OCI8::Metadata::View]