Oracle出现PLS-00103: 出现符号 “CREATE“错误编写一个名为DX4_08的程序包,包中重载两个过程

题目
编写一个名为DX4_08的程序包,包中重载两个过程,一个以员工号为参数,输出该员工信息;另一个以员工名为参数,输出员工信息。包中另一个过程利用两个重载过程分别查询员工号为7902、7934、以及员工名为SMITH、FORD的员工信息。

出现错误

LINE/COL  ERROR
--------- -------------------------------------------------------------
5/3       PLS-00103: 出现符号 "CREATE"
错误: 查看编译器日志

代码

create or replace package DX4_08 as
  procedure p1(vempno emp.empno%type);
  procedure p1(vename emp.ename%type);
  procedure p2;end;
  create or replace package body DX4_08 as procedure p1(vempno emp.empno%type)as
    vrow emp%rowtype;
    begin
      select * into vrow from emp where empno=vempno;
      dbms_output.put_line('姓名:'||vrow.ename||',职位:'||vrow.job||',管理者编号:'
                         ||vrow.mgr||',雇佣日期:'||vrow.hiredate||',工资:'||vrow.sal||
                         ',提成:'||nvl(vrow.comm,0)||',部门编号:'||vrow.deptno);
    end p1;
  procedure p1(vename emp.ename%type)as
    vrow emp%rowtype;
    begin
      select * into vrow from emp where ename=vename;
      dbms_output.put_line('姓名:'||vrow.ename||',职位:'||vrow.job||',管理者编号:'
                         ||vrow.mgr||',雇佣日期:'||vrow.hiredate||',工资:'||vrow.sal||
                         ',提成:'||nvl(vrow.comm,0)||',部门编号:'||vrow.deptno);
    end p1;
  procedure p2 as
    begin
      DX4_08.p1(7902);
      Dx4_08.p1(7934);
      DX4_08.p1('SMITH');
      DX4_08.p1('FORD');
    end p2;
  end;  
set serveroutput on;
exec DX4_08.p2;

解决

create or replace package DX4_08 as
  procedure p1(vempno emp.empno%type);
  procedure p1(vename emp.ename%type);
  procedure p2;end;
  /  “此处添加一个‘/’或上下两部分单独运行编译”
  create or replace package body DX4_08 as procedure p1(vempno emp.empno%type)as
    vrow emp%rowtype;
    begin
      select * into vrow from emp where empno=vempno;
      dbms_output.put_line('姓名:'||vrow.ename||',职位:'||vrow.job||',管理者编号:'
                         ||vrow.mgr||',雇佣日期:'||vrow.hiredate||',工资:'||vrow.sal||
                         ',提成:'||nvl(vrow.comm,0)||',部门编号:'||vrow.deptno);
    end p1;
  procedure p1(vename emp.ename%type)as
    vrow emp%rowtype;
    begin
      select * into vrow from emp where ename=vename;
      dbms_output.put_line('姓名:'||vrow.ename||',职位:'||vrow.job||',管理者编号:'
                         ||vrow.mgr||',雇佣日期:'||vrow.hiredate||',工资:'||vrow.sal||
                         ',提成:'||nvl(vrow.comm,0)||',部门编号:'||vrow.deptno);
    end p1;
  procedure p2 as
    begin
      DX4_08.p1(7902);
      Dx4_08.p1(7934);
      DX4_08.p1('SMITH');
      DX4_08.p1('FORD');
    end p2;
  end;  
set serveroutput on;
exec DX4_08.p2;

你可能感兴趣的:(oracle,数据库)