Oracle编程常见错误和分析
1. 资源正忙错误
在pl/sql developer开一个sql window,执行如下sql不提交
Create Table aa(a Int);
Insert Into aa Values(234);
再开一个sqlwindow执行
Drop Table aa
就会报ora-00054错误。
Oracle锁的知识:
此时Oracle已经对返回的结果集上加了排它的行级锁,所有其他对这些数据进行的修改或删除操作都必须等待这个锁的释放,产生的外在现象就是其他的操作将发生阻塞,这个这个操作commit或rollback.
同样这个查询的事务将会对该表加表级锁,不允许对该表的任何ddl操作,否则将会报出ora-00054错误::resource busy and acquire with nowait specified.
因为DDL语句需要表上的排他锁,而这与DML语句已在表上放置了共享锁相冲突,所以试图在表中插入一个列的这条DDL语句会失败.需要注意的是:在类似情况下,DML语句会等待并不断进行尝试,直至获得其所需的锁(换句话说就是挂起);而DDL语句则会由于错误立即终止.
ejb BllRequireNewTrans在ejb-jar.xml被配置为需要一个新事务,所以调用此ejb方法的事务和BllRequireNewTrans不在一个事务中,不注意就会引发上面的错误。
<container-transaction>
<method>
<ejb-name>BllRequireNewTrans</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>RequiresNew</trans-attribute>
</container-transaction>
</assembly-descriptor>
2. 字段被全部置空的错误
Create Table bb(a Int, b Int, c Int)
Insert Into bb Values(1,2,3)
Insert Into bb Values(3,2,3)
Insert Into bb Values(4,5,6)
Create Table cc(a Int, b Int, c Int);
Insert Into cc Values(1,20,30
相关文档:
进入sql*plus需要输入用户名、口令和主机标志符
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
以上为初始密码
主机字符串空或者是@+你的服务名,在本地登陆不需要本地服务名。
下面就介绍一下一些常用的sql*plus命令:
首先查看当前使用的数据库实例:
select name from V$database;
切换两个 ......
oracle字符串分割和提取
分割
create or replace function Get_StrArrayLength
(
av_str varchar2, --要分割的字符串
av_split varchar2 --分隔符号
)
return number
is
lv_str varchar2(1000);
lv_length number;
begin
lv_str:=ltrim(rtrim(av_str));
&nb ......
转:ORACLE
多表关联 UPDATE 语句
原帖:http://www.cnblogs.com/miley/archive/2010/04/15/1712617.html
为了
方便起见
,建立了以下简单模型
,和构造了部分测试数据
:
在某个业
务受理子系统
BSS中,
--客户资
料表
create table customers
(
& ......
CentOS 5.2下Oracle 10G 安装详解
2009-01-16 14:38
CentOS 必需的安装包
* GNOME Desktop Environment
* Editors
* Graphical Internet
* Text-based Internet
* Development Libraries
* Development Tools
* Legacy Software Development
* Server Configuration Tools
* Administration Tools
* Base
* Le ......