create table sales ( sales_id number, cust_id number, sales_amt number, sale_category varchar2(6) /* 虚拟列名及数据类型*/ generated always as ( case when sales_amt <= 10000 then 'LOW' when sales_amt > 10000 and sales_amt <= 100000 then 'MEDIUM' when sales_amt > 100000 and sales_amt <= 1000000 then 'HIGH' else 'ULTRA' end ) virtual /*虚拟列值函数内容*/ );
create or replace trigger tri_sales
for update of sales_amt on SALES
compound trigger
type ty_sales_log is table of sales_log%rowtype
index by pls_integer;
coll_sales_log ty_sales_log;
ctr pls_integer:=0;
before statement is
begin
dbms_output.put_line('in before statement');
end before statement;
before each row is
begin
dbms_output.put_line('in before each row');
end before each row;
after each row is
begin
ctr := ctr+1;
dbms_output.put_line('in after each row.sales_amt'||:new.sales_amt);
coll_sales_log(ctr).sales_id := :old.sales_id;
coll_sales_log(ctr).cust_id := :old.cust_id;
coll_sales_log(ctr).sales_amt := :new.sales_amt;
end after each row;
after statement is
begin
dbms_output.put_line('in after statement');
forall counter in 1..coll_sales_log.count()
insert into sales_log(sales_id,cust_id,sales_amt)
values (coll_sales_log(counter).sales_id,coll_sales_log(counter).cust_id,coll_sales_log(counter).sales_amt);
end after statement; /* 不能使用Insert into sales_log values
(coll_sales_log(counter));添加*/
end tri_sales;
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有