小菜鸟问:oracle中的一个触发器问题
问题
(1)表employees和department存在参照完整性约束,在表employees中插入记录(‘70’,‘999’)department_id为‘999’时,department表中还不存在department_id为‘999’的记录,所以违背了参照完整性约束,出现“Integrity constraint violation error”提示信息。
UPDATE employees SET department_id = 999 WHERE employee_id = 170;
-- Integrity constraint violation error
(2)
CREATE OR REPLACE TRIGGER constr_emp_trig
AFTER UPDATE ON employees
FOR EACH ROW
BEGIN
INSERT INTO departments
VALUES (999, 'dept999', 140, 2400);
END;
/
结果:Insert操作虽然违反了参照完整性约束,但employees表中依然成功插入了一条新记录。
相关文档:
oracle表空间操作详解
1
2
3作者: 来源: 更新日期:2006-01-04
5
6
7建立表空间
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
oracle中connect by prior实现递归查询
收集的几条在oracle中通过connect by prior来实现递归查询
Start with...Connect By子句递归查询一般用于一个表维护树形结构的应用。
创建示例表:
CREATE TABLE TBL_TEST
(
ID NUMBER,
NAME VARCHAR2(100 BYTE),
PID NUMBER   ......
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Admin>sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 20 19:31:44 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g E ......
安装过程中出现“X11/extensions/Print.h: No such file or directory”的解决方法
这是因为系统中缺少libXp-devel
# yum install libXp-devel
安装过程中出现“X11/bitmaps/gray: No such file or directory”的解决方法
这是因为系统中缺少xorg-x11-xbitmaps(x11/xbitmaps (Ubuntu) and xorg-x1 ......
Oracle数据字典常用查询
--查看当前用户所有表及描述
select o.object_name,c.comments
from user_objects o
left outer join user_tab_comments c
on o.object_name=c.table_name
where object_type='TABLE'
and c.comments like '%项目%'
--查看当前用户所有字段信息及描述
select c.table ......