此pl/sql块的功能是:
更新emp表,把字段名称为deptno为10的记录的comm更新为sal*10;
emp:表名
comm,sal,deptno都是字段名称
where后面是条件

解决方案 »

  1.   

    declare
    v_comm_percent constant number:=10;
    begin
    update emp
    set comm=sal*v_comm_percent
    where deptno=10;
    endcreate procedure name_pro(p_col1 in varchar2,p_col2 in varchar2,p_table in varchar2)
    as
    v_comm_percent constant number:=10;
    str varchar2(50);
    begin
    str:='update '||p_table||' set '||p_col1||'='||p_col2||'*v_comm_percent where deptno=10';
    execute immediate str;
    end;
    /
      

  2.   

    sorry,以下:
    create procedure name_pro(p_col1 in varchar2,p_col2 in varchar2,p_table in varchar2)
    as
    v_comm_percent constant number:=10;
    str varchar2(50);
    begin
    str:='update '||p_table||' set '||p_col1||'='||p_col2||'*v_comm_percent where deptno=10';
    execute immediate str;
    end;
    /
      

  3.   

    各位老大,函数我已经运行出来了
    但beckhambobo(beckham)兄台写的过程没看明白:)