java - How to obtain the length of VARCHAR2 attribute declared in Oracle Object Type, using OracleTypeCHAR metadata, regardless of database character set -
my java application depends on oracle object types metadata. use oracle.jdbc.oracore.oracletypechar class access these metadata jdbc. after converting database charset al32utf8, oracletypechar#getlength() method returns results multiplied factor of 4 comparing declared in oracle object type - example:
some_attribute varchar2(10) would result in lenght 40, when lenght 10 returned previous charset. there way obtain raw value pl/sql without parsing oot source code?
the character length character column can found in user_tab_columns.char_length,
select column_name, comments all_col_comments table_name = 'user_tab_columns'; column_name comments table_name table, view or cluster name column_name column name data_type datatype of column data_type_mod datatype modifier of column data_type_owner owner of datatype of column data_length length of column in bytes data_precision length: decimal digits (number) or binary digits (float) data_scale digits right of decimal point in number nullable column allow null values? column_id sequence number of column created default_length length of default value column data_default default value column num_distinct number of distinct values in column low_value low value in column high_value high value in column density density of column num_nulls number of nulls in column num_buckets number of buckets in histogram column last_analyzed date of recent time column analyzed sample_size sample size used in analyzing column character_set_name character set name char_col_decl_length declaration length of character type column global_stats statistics calculated without merging underlying partitions? user_stats statistics entered directly user? avg_col_len average length of column in bytes char_length maximum length of column in characters char_used c maximum length given in characters, b if in bytes v80_fmt_image column data in 8.0 image format? data_upgraded has column data been upgraded latest type version format? histogram use query find character length of column,
select char_length user_tab_columns table_name = 't' , column_name = 'some_attribute';
Comments
Post a Comment