1. 好像不需要函数了,除非你的税金的计算很复杂,那你就写一个根据工资算税金的函数。 insert into tax_table (id,name,tax)
( select id,name,(salary - 1000) * 0.1 from base_table );2.
create or replace trigger base_update
before update of sal_level on base_table
for each row
begin
:new.salary := :old.salary + (:new.sal_level - :old.sal_level) * 500;
end;
/
( select id,name,(salary - 1000) * 0.1 from base_table );2.
create or replace trigger base_update
before update of sal_level on base_table
for each row
begin
:new.salary := :old.salary + (:new.sal_level - :old.sal_level) * 500;
end;
/
解决方案 »
- APEX安装中文问题
- PL/SQL DEVELOPER的配置为题
- TNS-12560协议适配器错误
- 日期型数据显示在页面中和显示在excel中为什么格式不一样呢?
- 请问ORACLE登录问题 报错:ora-01017
- 求SQL语句,两句如何合并成一句
- 求一oracle语句
- 求教oracleSQL的写法
- 推荐一个专业的数据库技术网站
- 为什么用sqlldr导入数据后中文都是乱码,急呀!
- 土土的问
- java.sql.SQLException: ORA-24327: 在证明一个用户之前,需要明确的连接 - (icbc/********@@192.168.0.210:1521:icbc)++++++在线。。。
不过我主要是为了学PL/SQL
来了解一下函数和过程的写法,
谢谢 Lastdrop(空杯) ( )
所以还是想用函数做出来。
(因为才看PL/SQL几天,只能看得懂语法,而这方面能够比较快上手的资料不多,
所以想看一下怎么用函数做。)
create or procedure c_table(p_id in varchar2)
as
begin
update tax_table a (tax)=( select (salary - 1000) * 0.1 from base_table where a.id=id and id=p_id);
end;
/
函数也大同小异,只是函数要返回值.