(8.0.32)
drop table tab1 ;
create table tab1(
col1 bigint
, col2 bigint default -1
, col3 varchar(100)
, col4 varchar(100) default 'A'
, col5 datetime
, col6 datetime default now()
);
select ordinal_position
, column_name
, data_type
, character_maximum_length
, numeric_precision
, numeric_scale
, is_nullable
, column_default
, column_comment
from information_schema.columns
where table_schema= 'test'
and table_name = 'tab1'
order by ordinal_position
;
insert into tab1(col1) values(1);
select * from tab1;
(19c)
drop table tab1 purge;
create table tab1(
col1 int
, col2 int default -1
, col3 varchar2(100)
, col4 varchar2(100) default 'A'
, col5 timestamp
, col6 timestamp default systimestamp
);
select COLUMN_ID
, COLUMN_NAME
, DATA_TYPE
, DATA_LENGTH
, DATA_PRECISION
, DATA_SCALE
, NULLABLE
, DATA_DEFAULT
from all_tab_cols
where table_name = 'TAB1'
order by COLUMN_ID
;
insert into tab1(col1) values(1);
commit;
select * from tab1;
(15)
drop table tab1 ;
create table tab1(
col1 bigint
, col2 bigint default -1
, col3 varchar(100)
, col4 varchar(100) default 'A'
, col5 timestamp
, col6 timestamp default clock_timestamp()
);
select ordinal_position
, column_name
, data_type
, character_maximum_length
, numeric_precision
, numeric_scale
, is_nullable
, column_default
from information_schema.columns
where table_catalog='test'
and table_schema = 'public'
and table_name = 'tab1'
order by ordinal_position
;
insert into tab1(col1) values(1);
select * from tab1;
(2022)
drop table tab1 ;
create table tab1(
col1 bigint
, col2 bigint default -1
, col3 varchar(100)
, col4 varchar(100) default 'A'
, col5 datetime2
, col6 datetime2 default sysdatetime()
);
go
select ordinal_position
, column_name
, data_type
, character_maximum_length
, numeric_precision
, numeric_scale
, is_nullable
, column_default
from information_schema.columns
where table_catalog='test'
and table_schema = 'dbo'
and table_name = 'tab1'
order by ordinal_position
;
go
insert into tab1(col1) values(1);
select * from tab1;
go