
1、创建表:
create table test
(id int,
begin_time date)2、添加数据:
insert into test values (1,to_date('2015-01-01','yyyy-mm-dd'))
commit其中to_date('2015-01-01','yyyy-mm-dd')就是将2015-01-01这个字符串通过to_date函数转换成date类型的过程。
时候有需要在oracle数据库中添加多个字段的需求,案例如下:alter
table
my_workflow
add
(state
varchar2(2)
default
'0'
not
null,name
varchar2(100)
not
null,age
number
default
0
not
null)
上面的语句解释:
表名:my_workflow
添加了3个字段:
字段1:字段名称:state,
:varchar2(2)
,默认值'0',不为空(not
null)
字段2:字段名称:name
,数据类型:varchar2(100),不为空(not
null)
字段3:字段名称:age,数据类型number,默认值0,不为空(not
null)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)