oracle简单使用

oracle中只能使用values插入数据,想要批量插入,就要拼接

oracle中相对字符串数据排序,可以使用to_number(字段名)

select *  from (
select *  from test t where t.is_use='Y' ) where rownum<10

  

oracle的for update 会造成锁表操作

oracle创建表,对字段设置默认值

create table test(
    id_test varchar2(32) not null,
   is_use varchar2(2) default 'Y' not null

)initrans 6;

 创建表的同义词

create public synonym test for test

  删除同义词

drop public synonym test

  查询oracle数据库中表的记录数(限制返回10行)

select *  from (
select *  from test  t where t.is_use='Y' ) where rownum<10

 按照时间查询

select *  from test t where t.d_time>=to_date('2022-07-06 00:00:00','yyyy-mm-dd hh24:mi:ss')

  删除表中字段

alter table 表名 drop column 字段名(即列名);

test  表名
name  字段名

alter table test drop column name;

  

删除表中索引,通过pl/sql工具查看表中索引的名称

drop index 索引名称

  

posted @ 2022-07-05 00:10  不忘初心2021  阅读(127)  评论(0编辑  收藏  举报