view还可以直接修改吗?view不是根据源表的改变自动改变的吗?若强行对view进行insert,update,delete不是会出现ora-01732的错误信息吗?
解决方案 »
- 在oracle中求一简单sql
- 超难sql
- 出货优先匹配规则
- 求救!!!解决办法 ORA-01555&ORA-06512(存储过程改动)
- 这个SQL如何写
- 救救超菜鸟---对一备份文件如何下手啊?
- 运行ORACLE的SQL*PLUS提示oracle not available,请教应如何解决?
- 在ORACLE8.17数据库中有10000个表,有什么方法能够,检索出所有,有数据的表,并把结果保存到文件中
- ★★在sqlplus中怎么将查询的结果导出到一个txt文件中,默认存在什么地方,是用Spool吗,参数可以设置吗?★★
- database link 问题
- pro*c
- 请问哪儿有免费的ORACLE8或ORACLE9的下载啊?
建议还是修改原表,视图的数据也会自动变化。
In this example, customer data is stored in two tables. The object view ALL_CUSTOMERS is created as a UNION of the two tables, CUSTOMERS_SJ and CUSTOMERS_PA. An INSTEAD OF trigger is used to insert values.
CREATE TABLE customers_sj
( cust NUMBER(6),
address VARCHAR2(50),
credit NUMBER(9,2) );
CREATE TABLE customers_pa
( cust NUMBER(6),
address VARCHAR2(50),
credit NUMBER(9,2) );
CREATE TRIGGER
CREATE TYPE customer_t AS OBJECT
( cust NUMBER(6),
address VARCHAR2(50),
credit NUMBER(9,2),
location VARCHAR2(20) );
CREATE VIEW all_customers (cust)
AS SELECT customer_t (cust, address, credit, ’SAN_JOSE’)
FROM customers_sj
UNION ALL
SELECT customer_t (cust, address, credit, ’PALO_ALTO’)
FROM customers_pa;CREATE TRIGGER instrig
INSTEAD OF INSERT ON all_customers
FOR EACH ROW
BEGIN
IF (:new.cust.location = ’SAN_JOSE’) THEN
INSERT INTO customers_sj
VALUES (:new.cust.cust, :new.cust.address,:new.cust.credit);
ELSE
INSERT INTO customers_pa
VALUES (:new.cust.cust, :new.cust.address, :new.cust.credit);
END IF;
END;