Oracle左右全连接总结
--建立测试数据
create table a(id number);
create table b(id number);
insert into a values(1);
insert into a values(2);
insert into a values(3);
insert into b values(1);
insert into b values(2);
insert into b values(4);
commit;
--左:
--主流数据库通用的方法
select * from a left join b on a.id=b.id;
--Oracle特有的方法
select * from a, b where a.id=b.id(+);
ID ID
---------- ----------
1 1
2 2
3
--右:
--主流数据库通用的方法
select * from a right join b on a.id=b.id;
--Oracle特有的方法
select * from a, b where a.id(+)=b.id;
ID ID
---------- ----------
1 1
2 2
4
--内
--主流数据库通用的方法
select * from a join b on a.id=b.id;
--where关联
select * from a, b where a.id=b.id;
ID ID
---------- ----------
1 1
2 2
--全外
--主流数据库通用的方法
select * from a full join b on a.id=b.id;
--Oracle特有的方法
select *
from a, b
where a.id = b.id(+)
union
select *
from a, b
where a.id(+) = b.id;
ID ID
---------- ----------
1 1
2 2
3
4
--完全,也叫交叉连接或者笛卡尔积
--主流数据库通用的方法
select * from a,b;
--或者
select * from a cross join b;
ID ID
---------- ----------
1 1
1 2
1 4
2 1
2 2
2 4
3 1
3 2
3 4
连接无非是这几个
--内连接和where相同
inner join
--左向外连接,返回左边表所有符合条件的
left join
--右向外连接,返回右边表所有符合条件的
right join
--完整外部连接,左向外连接和右向外连接的合集
full join
--交叉连接,也称笛卡儿积。返回左表中的每一行与右表中所有行的组合
cross join
--补充:
--左向外连接,返回左边表所有符合条件的,
--注意这里没有第二个加号,会直接过滤掉数据,只显示符合条件的记录
select *
from a, b
where a.id = b.id(+)
and b.id = 2;
ID ID
---------- ----------
2 2
--左向外连接,返回左边表所有符合条件的
--注意where上第二个加号,它的作用是修改右边表记录的显示,例如如果b.id(+) = 2,显示为2,否则显示null
select *
from a, b
where a.id = b.id(+)
and b.id(+) = 2;
ID ID
---------- --
相关文档:
方案一:
新装了系统后,发现在调试程序时TOMCAT提示8080端口已被占用,于是运行NETSTAT -ANO查看端口使用情况,发现8080端口被ORACLE的监听器给占用了,于是结合上网查到方法,将ORACLE XDB的HTTP服务端口改成8081,问题解决。
总结一下可解决的方 ......
trunc()函数有两种用法 1:后面跟日期 2: 后面跟数字
A: SELECT a.times,to_date(a.times,'yyyymmdd'),trunc(to_date(a.times,'yyyymmdd'),'month') from dmf_loan_limit a
显示的结果为:
1 20080131 2008-1-31 2008-1-1
2 20080131 &nb ......
配置信息应该都没有错,驱动也反复加载了,没有问题
运行Myeclipse编译可过,在网页测试时出现如下错误:
java.sql.SQLException: 调用中无效的参数
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError ......
我用的是Centos5.4 DVD光盘安装的linux操作系统,安装linux的时候选上开发工具,Xmanager,与数据库相关的包。
操作系统安装完成之后需要进行一系列的配置才能安装oracle10g,下面把主要步骤记录下来。
1.安装完操作系统之后还是有些包没有安装,然而安装oracle10g的时候需要用到,没有安装的包有:
libXp-1.0.0-8.i386.rp ......