oracle 和informix 的基础区别

1:查看表空间
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等来避免出错


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';

待继续完善,谢谢



原文地址:https://www.cnblogs.com/james1207/p/3285684.html