0 0

PLS-00103: Encountered the symbol "CREATE"5

SQL> --编写一个私有函数log_message(),从公共过程中将共有功能移到一个私有函数中
SQL> create or replace package employee_pkg as
  2  procedure print_ename(p_empno number);
  3  procedure print_sal(p_empno number);
  4  end employee_pkg;
  5  --建立或重新定义程序包的主体
  6  create or replace package body employee_pkg as
  7  --编写log_message()过程
  8   procedure log_message(p_message varchar2) is
  9     pragma autonomous_transaction;
10     begin
11       insert into log_table(username,date_time,message)
12       values (user,current_date,p_message);
13       commit;
14       end log_message;
15  --编写函数,从emp表中返回一行记录
16  function get_emp_record(p_empno number) return emp%rowtype is
17    l_emp_record emp%rowtype;
18    begin
19      log_message('Looking for record where EMPNO='||p_empno);
20      select * into l_emp_record from emp
21      where empno=p_empno;
22      return l_emp_record;
23      exception
24        when NO_DATA_FOUND then
25          return null;
26          end get_emp_record;
27   --编写向屏幕输出,并且对输出进行日志记录的过程
28   procedure print_data(p_emp_record emp%rowtype,p_column varchar2) is
29     l_value varchar2(4000);
30     begin
31       if p_emp_record.empno is null then
32         log_message('NO DATA FOUND.');
33         dbms_output.put_line('NO DATA FOUND.');
34        else
35          case p_column
36            when 'ENAME'then
37              l_value:=p_emp_record.ename;
38             when 'SAL' then
39               l_value:=nvl(p_emp_record.sal,0);
40             else
41               l_value:='Invaild Column';
42               end case;
43               log_message('About to print'||p_column||l_value);
44               dbms_output.put_line(p_column||'='||l_value);
45               end if;
46               end print_data;
47  --重新实现公共过程,完成程序包
48  procedure print_ename(p_empno number) is
49    begin
50      print_data(get_emp_record(p_empno),'ENAME');
51      end print_ename;
52 
53      procedure print_sal(p_empno number) is
54        begin
55          print_data(get_emp_record(p_empno),'SAL');
56          end print_sal;
57 
58          end employee_pkg;
59  /

Warning: Package created with compilation errors

SQL> show error;
Errors for PACKAGE SCOTT.EMPLOYEE_PKG:

LINE/COL ERROR
-------- -------------------------------------------
6/1      PLS-00103: Encountered the symbol "CREATE"

请指点,谢谢!
2014年4月27日 15:09

1个答案 按时间排序 按投票排序

0 0

在oracle create package语句中只creat package,也就是
  1 create or replace package employee_pkg as
  2  procedure print_ename(p_empno number);
  3  procedure print_sal(p_empno number);
  4  end employee_pkg;
后面的body体在package body 下进行管理。

2014年4月28日 15:59

相关推荐

    ISO 11452-4-2020.pdf

    - **Excitation Levels and Frequencies**: Specific levels and frequencies of electromagnetic energy are prescribed to ensure that the tests are representative of potential disturbances encountered ...

    【Oracle点滴积累】解决ORA-29913和KUP-04095: preprocessor command的方法

    KUP-04095: Preprocessor command encountered error "pipe Read Timeout (Doc ID 2641386.1)

    oracle错误代码大全

    #### ORA-00023: Failed to open the shared memory segment - **解释**: 无法打开共享内存段。 - **解决方案**: 检查操作系统级别的问题,例如权限、空间不足等。 #### ORA-00024: Object is in invalid state -...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    oracle 错误一览表

    #### ORA-00069: Unable to create temporary file - **描述**:无法创建临时文件。 - **解决方法**:检查磁盘空间和文件系统权限。 #### ORA-00070: Checkpoint not complete - **描述**:检查点未完成。 - **解决...

    Unity plug NGUI Next Gen UI V3.8.0

    最新NGUI V 3.8.0 3.8.0 ...- NEW: Setting a Unity sprite on a UI2DSprite will now automatically set its border values. ...- FIX: Variety of fixes for obscure issues that most would have never encountered.

    testing-java-microservices:该存储库用于研究“测试Java微服务-使用Arquillian,Hoverfly,AssertJ,JUnit,Selenium和Mockito”

    该存储库用于研究 。其他参考服务游戏容器:使用Maven 3.6,此古老版本... An API incompatibility was encountered while executing org.wildfly.swarm:wildfly-swarm-plugin:2017.11.0:package: java.lang.AbstractM

    Keil v5 Error: Encountered an improper argument 个人实测解决办法

    Keil v5 Error: Encountered an improper argument 个人实测解决办法 实测运行正常咯,再也不出现仿真关不了debug情况了

    µVISION: Error: Encountered an improper argument

    标题中的"µVISION: Error: Encountered an improper argument"是一个在使用Keil µVision集成开发环境时可能会遇到的问题提示。这个错误通常意味着在执行某些操作或者仿真过程中,软件遇到了无法识别或者不合法的...

    高中英语必修五Unit15 Learning作业题及答案解析6份2精选.docx

    - "On the first day when my mother came here, she met with a lot of troubles." 转换为:"Upon my mother's arrival here, she encountered numerous difficulties." - "We all believe that the place of ...

    JSqlparser4.4版作者提供的应急版,解决无法解析mysql中JSON_OBJECT函数存在其它函数问题

    如下sql,JSON_OBJECT函数中存在CAST函数,随后...Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "SELECT" at line 18, column 10. Was expecting one of: "!" "(" "NOT

    Oracle错误一览表

    #### ORA-00023: Internal error encountered 这是一个非常通用的错误,表示Oracle内部遇到了无法处理的问题。这类错误通常与软件bug有关,可能需要联系Oracle支持服务进行解决。 #### ORA-00024: Mode 2 rollback...

    Error: Encountered an improper argument 官方解决办法

    Download the attached file and extract it to the folder C:\Keil_v5\UV4. If you have installed PK51 to a different folder, you need to adapt the path accordingly. The file UV4.exe is replaced with ...

    SMTP错误码建议解决方法

    4201. Timeout Communication Problem Encountered During Transmission 这个错误码表示在邮件传输过程中出现了超时通信问题。可能是 Novell GroupWise SMTP 服务器的问题,在此不多做赘述。 4211. Service Not ...

    WsdlReader

    【WsdlReader】是一个工具,主要用于在C#编程环境下便捷地读取并使用Web服务(Web Service)的代理类。这个工具对于开发者来说是学习和理解如何与Web服务交互的一个重要参考。通过WsdlReader,程序员可以自动化处理...

    MDK Error: Encountered an improper argument 官方解决办法

    Keil-MDK Error Encountered an improper argument 问题解决办法实测有效,此问题属于keil的软件bug,在mdk5.2x版本中普遍出现,最新的mdk5.26版本也没有解决此软件bug,所以分享此解决办法让更多人免于受此问题困扰...

    HTTP 500 内部服务器错误修正办法.txt

    The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server ...

    Delphi编译错误中文手册

    15. **Bad global symbol definition: '<Name>' in object file '<Filename>'** - 错误描述:对象文件 `<Filename>` 中的全局符号 `<Name>` 定义有误。 - 解决方法:检查全局符号的定义是否正确。 16. **Bad unit...

    certbot-auth-dnspod:用于 DNSPod 的 Certbot DNS 身份验证器

    Certbot DNS Authenticator For ... The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',). Skipping. Installi

Global site tag (gtag.js) - Google Analytics