`

Oracle 遇到的一些问题

阅读更多

1.ORA-08002:序列s_seq.currval沿未在此进程中定义

 

2.insert into student(id,name) values(student_seq.nextval,'张伟')
,(student_seq.nextval,'李四'); 插入多条语句

 

3.raw类型

 

4.timestamp类型  yyyy-mm-dd 如何在数据库里保存yyyy-mm-dd这样的形式

 

5.ORA-01658: 无法为表空间SHOP中的段创建INITIAL区

 

6.not exists

 

7.delete truncate的区别:

 

8.多表使用一个语句插入: insert all
insert all into student2(id,name)
values(zw.student_seq.nextval,'兄弟'||zw.student_seq.currval)
into student2(id,name)
values(zw.student_seq.nextval,'兄弟'||zw.student_seq.currval)
select * from dual;

 

9. 行列转换
(1)固定列: decode,group by
(2)列数不固定: 使用pl/sql,function

 

10.ORA-00928:缺少select关键字

 

11.decode函数:select id,name,decode(sex,'1','男','0','女','不男不女') from student2

12.去除重复行 select (distinct) (*...,id,name) from tab
distinct 只放在列的前面

 

另一种方法:

delete from table1 t1
  where t1.rowid > (select min(t2.rowid) from table1 t2 where t1.id = t2.id);

 

13.命令:save,edit,spool

14.列修饰符:format,heading (text),justify (right,center,left)
SQL> column today format A25;
SQL> select * from student2;

 

15.stddev,variance统计方差

16.tablespace
create tablespace app_data
datafile '/data_1.dbf'  size 100m,
 '/data_.dbf' 100m
minimum extent 500k
default storage (initial 500k
  next 500k
  maxextents 500
  pctincrease 0);

 

17. analyze,sql优化

18.role ,grant

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics