当前位置: 代码迷 >> Informix >> oracle 跟informix 的基础区别
  详细解决方案

oracle 跟informix 的基础区别

热度:982   发布时间:2016-05-05 08:56:43.0
oracle 和informix 的基础区别


1:[oracle]查看表空间

select
b.file_name 物理文件名,
b.tablespace_name 表空间,
b.bytes/1024/1024 大小M,
(b.bytes-sum(nvl(a.bytes,0)))/1024/1024 已使用M,
substr((b.bytes-sum(nvl(a.bytes,0)))/(b.bytes)*100,1,5) 利用率
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_name,b.bytes
order by b.tablespace_name

2:oracle
select into 如果不存在记录的时候会报错

这个时候可以使用count(*)或者是max等来避免出错

informix select into 如果不存在记录则该字段为null


3:oracle执行存储过程是直接调用存储过程名称就行
而informix则需要call 或者是execute procedure
informix调用call 如果有错误只是会提示笼统错误。而execute则是提示具体错误

4:informix更新语句是Update tablename set(字段1,字段2)=(value1,value2);
而oracle 的更新则是Set 字段一=value1,字段二=value2

5:informix的赋值语句是let __TimeConfig=0;
而oracle的赋值语句是:__TimeConfig :=0;

6:对于判断是否存在,informix 可以用 exists直接在存储过程中调用,而不仅仅是select 语句中
if exists(select 1 from gspmajor where majorid=M_MajorID) then
let __IsGSPSHeet=1;
end if
oracle 则不行

oracle 一般使用count 判断


7:informix 可以在存储过程中直接创建临时表
create temp table t_SumFeeInfo1
(
sumMemDiscRate  dec(12,2),--VIP卡折扣率
sumAllocateRate  dec(12,2),--折扣费用分摊
sumVipDDisc   dec(12,2),--会员日折扣率
sumVipAllocateRatedec(12,2),--会员日折扣分摊比
sumMaterialFee  dec(12,2),--能源物料使用费
sumShopExtFee   dec(12,2),--店铺扩展费
sumTotalYearFee  dec(12,2),--年度费用汇总
sumGuarantyAmt  dec(12,2)--保证金
) with no log;
或者是直接select A.a1,A.a2 into  temp tmp_mallccsheetashopgoods with no log;

而oracle如果在存储过程中,则需要调用
execute immediate 
'create GLOBAL TEMPORARY table tmp_orderdif(
GoodsID    int    not null,  --商品编码
DiffQty    dec(12,3)   default 0 not null--验收差异量
);

drop table  tmp_orderdif';


8: informix 中 创建表的时候 最好指明扩展容量以及锁的模式

但是 索引空间可以不需要

create table rationref
(
sheetid varchar(20)not null,--配送单号
Refsheetid varchar(20)not null,--配送通知单号
RefSheetType int default 0 not null,--相关单类型 0=配送/返配单 1=退货通知单 2=直通订货单号
RetShopID     varchar(6),   --退货地
primary key (RefSheetID,sheetid,RefSheetType),
foreign key (sheetid) references ration (sheetid)
)extent size 1600 next size 1600 lock mode row;


而oracle 创建表不需要设置,但是需要设置索引空间

create table rationref
(
sheetid varchar(20)not null,--配送单号
Refsheetid varchar(20)not null,--配送通知单号
RefSheetType int default 0 not null,--相关单类型 0=配送/返配单 1=退货通知单 2=直通订货单号
RetShopID     varchar(10),   --退货地
primary key (RefSheetID,sheetid,RefSheetType) using index tablespace IDX_PCCOMS
);

9:oracle 给date 赋值的时候 需要使用default to_date('1900-01-01','')方式

而informix则不需要default '1900-01-01' not null,


待继续完善,谢谢



  相关解决方案