oracle 教材

alter session set nls_date_format='dd-mon-yyyy hh24:min:ss';
select current_date from dual;


修改 显示当前时间的格式
-------------------------------------------------------------------
对空值处理
select a,nvl(b,'为输入') from table1

------------------------------------
左外连接
select a.id,b.name from a ,b where a.id=b.id(+)
全部显示左边a,没有的用空值替代,不完全匹配
右外连接
select a.id,b.name from a ,b where a.id(+)=b.id
全部显示右边b

--------------------------------------------------------------------
select a ,count(a) from table where group by a having count(a)>1

查询 字段重复字段
---------------------------------------------------------------
union  去重复
intersect  显示重复
----------------------------------------------------------------

oracle 创建表 且数据 依赖 其他表
create  table a as select e.di ,e.name from e where e.id=001


-----------------------------------------------------------------


pl/sql

sql>set serveroutput on size 1000

sql>dbms_output.put_line('x的值'||X);


循环
begin
for i in 1..5 loop
dbms_output.put_line('i的值'||i);
end loop;
end 
/



begin
for i in  reverse 1..5 loop
dbms_output.put_line('i的值'||i);
end loop;
end 
/

-----------------------


你可能感兴趣的:(oracle,sql)