您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Oracle中的数据类型和表的管理

2024/4/1 4:52:49发布18次查看
日期类型 date 包含年月日和时分秒 timestamp 这是oracle9i对date数据类型的扩展 (时间戳)date类型的时间更精确 图片类
日期类型
   date 包含年月日和时分秒
   timestamp 这是oracle9i对date数据类型的扩展 (时间戳)date类型的时间更精确
图片类型
   blob 二进制数据可以存放图片 和声音 4g
oracle表的管理
 创建表一个student表的语句
  create table student(
    xh number(4),
    xm varchar2(20),
    sex char(2),
    birthday date,
    sal number(7,2)
    );
  创建表一个tclass表的语句
   create table tclass(
     class_id number(2),
     cname varchar2(20)
     );
修改表
   在student表中添加一个字段class_id
   alter table student add(class_id number(2));
   在student表中修改一个字段xm
   alter table student modify (xm varchar2(30))
   在student表中删除一个字段xm
  alter table student drop column xm;
  怎样改oracle中的默认日期(因为在oracle中日期默认为 日月年)
   alter session set nls_date_format='yy-mm-dd'
使用is 关键字查询null值
  select * from student where birthday is null;
使用like关键字
  select * from student where xh like '%3%';
  更新student表中xh=1234的birthday为 null值
  update student set birthday = null where xh = 1234
  删除数据
  delete from student;
oracle 支持事务回滚
 设置 一个点 savepoint a ;
 执行 delete from student 语句 删除表中的所有数据
 然后回到 我们设置的点a
 执行的语句 :rollback to a ;
执行完后我们在去查询数据表的数据 将会 回到删除前的状态。
 使用truncate 删除表 表的结构还在, 不写日志,无法找回删除的记录 ,, 但速度快。
执行语句:truncate table student
 使用delete 删除表
 使用delete删除会将表的结构删除 这张表将不会存在。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product