ORACLE常用SQL
一.ORACLE常用表
1.dual ORACLE用来给没有表的运算符.如:select sysdate from dual;
二.字符串操作
1.|| 字符串加法 select 'a'||'bc' from dual; --'abc'
三.时间和日期
1.sysdate 系统当前的日期
sysdate-1 减少一天;sysdate+1 增加一天;sysdate -1/24 减少一小时; sysdate+1/24 增加一小时;sysdate-1/24/60 减少一分钟;sysdate-1/24/60/60 减少一秒
2.add_months(sysdate,2) 增加二个月; add_months(sysdate,-2) 减少两个月;
3.字符与时间转换
to_char(sysdate+7,'yyyy-mm-dd HH24:MI:SS') 日期转字符串
to_date(字符串,时间格式) 字符串转时间
四.常用函数
1.nvl(a,b) 如果a为空则用b值,否则用a值.b的类型可以与a的类型不一样.
相关文档:
什么是合并多行字符串(连接字符串)呢,例如:
SQL> desc test;
Name Type Nullable Default Comments
------- ------------ -------- ------- --------
COUNTRY VARCHAR2(20) Y &nb ......
CREATE TABLESPACE mySpace
datafile
'd:\data\data1.dbf' size 1M reuse
autoextend on next 100k maxsize 2M
'd:\data\data2.dbf' size 1M reuse
online
permanent;
其中online表联机。
联机和脱机的区别和使用
联机: ORACLE服务进程关联文件。可供oracle客户端访问.如果在系统中直接删除时会弹出异常。
脱机: ......
create or replace procedure TestJiaoJi
is
type nt_table_type is table of number;
nt1 nt_table_type:=nt_table_type(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
nt2 nt_table_type:=nt_table_type(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ......
Partition outer join is a new mechanism in 10g to "invent" data to fill the gaps in non-contiguous results. In 10g there are many methods to deal with such a problem (including the awe-inspiring, but equally terrifying, MODEL clause). In older versions of Oracle, "data-densification" was not as simp ......
1.OracleDBConsoleorcl oem控制台的服务进程
2.OracleJobSchedulerORCL 定时器的服务进程
3.OracleOraDb10g_home1iSQL*Plus isql*plus的服务进程
4.OracleOr ......