• Oracle (分类、数据库类型、序列)


    分类:

    1.DDL (定义语句) create  、alter 、drop 

      不需要commit

      create table aaa(

      tt1 varchart

    )

      

    2. DML (操纵语句)

      lnset、update、delete

      Select......for update

    传统数据库

     Oracle数据库

    create table bbb(
    tt1 varchar2(10)
    )


    insert into aaa values('123');
    insert into aaa(tt1) values('123');
    insert into aaa values('789'),('456'),('abc');


    create table aaa(
    tt1 varchar2(10),
    tt2 varchar2(100)
    );

    --提交
    commit

    select * from aaa;

    --物理
    select rowid,rownum,tt1 from aaa;


    update aaa set tt1='aaaaaa'
    select * from aaa for update;

    select * from aaa;
    commit


    --插入多条数据
    insert all
    into aaa values('123')
    into aaa values('456')
    into aaa values('789')
    select 1 from dual;


    --Oracle 数据类型
    --1 char 类型 (固定长度的类型)
    --数据不足长度,会填空格
    create table test1(
    a char(6)
    )
    insert into test1(a) values('123')
    select * from test1;


    --Oracle 数据类型
    --2 varchar2 类型 (不固定长度的类型,少于4000)
    --数据不足长度,会填空格
    create table test2(
    a varchar2(10)
    )
    insert into test2(a) values('1234567');
    commit
    select * from test2;


    --Oracle 数据类型
    --3 number 实数类型(默认就是38位)
    create table test3(
    a number
    )
    insert into test3 values (123)
    insert into test3 values (134.12)
    insert into test3 values (12312313456456456465456456)
    select * from test3;

    create table test4(
    a number(10)
    )
    insert into test4(a) values (1234567890);
    insert into test4(a) values (13215454);
    insert into test4(a) values (123.99); --四舍五入 结果是 124
    select *from test4;

    create table test5(
    a number(5,2) --整数五位,小数二位
    )
    --超出范围,不像整数的定义,整数会四舍五入
    insert into test5(a) values(12345.789)


    --Oracle 数据类型
    --4 date 类型(日期加时间) 跟java.util.Date保持一致
    --java
    --java.sql.Date (日期)
    --java.util.Date(日期加时间)
    create table test6(
    a date
    )

    select 1 from dual
    select to_date('日期字符串','日期格式')from dual

    select to_date('2018-03-09 10:16:33','yyyy-mm-dd hh24:mi:ss')from dual
    insert into test6 values (to_date('2018-03-09 10:16:33','yyyy-mm-dd hh24:mi:ss'))

     

  • 相关阅读:
    解决android运行速度慢的问题
    nginx配合tomcat、resin等java应用服务器提供java支持(转)
    部分面向对象习题,留给学生做不错!!!
    该内存不能为“read”或“written”
    ORACLE数据库管理系统体系结构详解
    Linux下设置ORACLE自启动
    Oracle静默安装模板
    python安装步骤
    Oracle删除重复索引
    windows操作系统下python IDLE安装
  • 原文地址:https://www.cnblogs.com/zengxiangcai/p/8532559.html
Copyright © 2020-2023  润新知