zoukankan      html  css  js  c++  java
  • Oracle/PLSQL: ORA-06550

    参考:
    http://blog.csdn.net/haiross/article/details/20612135

    Oracle/PLSQL: ORA-06550

    Learn the cause and how to resolve the ORA-06550 error message in Oracle.
    Description

    When you encounter an ORA-06550 error, the following error message will appear:

    ORA-06550: line num, column num: str
    

    Cause of Error

    You tried to execute an invalid block of PLSQL code (like a stored procedure or function), but a compilation error occurred.
    How to Resolve the Error

    The option(s) to resolve this Oracle error are:
    Option #1

    Refer to the line and column numbers (in the error message) to find the compilation error and correct it. Then try recompiling your code.

    Let's look at an example of how to resolve an ORA-06550 error. For example, if you created a procedure calledTestProc as follows:

    SQL> CREATE OR REPLACE PROCEDURE TestProc
    2 AS
    3 vnum number;
    4 BEGIN
    5 vnum := vAnotherNum;
    6 END;
    7 /

    Warning: Procedure created with compilation errors.

    This procedure was created with compilation errors. So if we try to execute this procedure, we will get an ORA-06550 error as follows:

    SQL> execute TestProc();
    BEGIN TestProc(); END;

    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00905: object EXAMPLE.TESTPROC is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    You can run the SHOW ERROR command to view the errors as follows:

    SQL> show error procedure TestProc;
    Errors for PROCEDURE TESTPROC:

    LINE/COL ERROR


    5/1 PL/SQL: Statement ignored
    5/9 PLS-00201: identifier 'VANOTHERNUM' must be declared

    As you can see, the error is caused by the variable called VANOTHERNUM not being declared. To resolve this error, we can modify ourTestProc procedure to declare the variable as follows:

    SQL> CREATE OR REPLACE PROCEDURE TestProc
    2 AS
    3 vnum number;
    4 vAnotherNumber number;
    5 BEGIN
    6 vAnotherNum := 999;
    7 vnum := vAnotherNum;
    8 END;
    9 /

    Procedure created.

    And now when we execute our TestProc procedure, the ORA-06550 error has been resolved.

    SQL> execute TestProc();

    PL/SQL procedure successfully completed.

  • 相关阅读:
    个人软件过程详细需求分析
    班级网站分析
    PSP个人软件开发系统面向对象需求分析与设计文档
    Psp个人软件开发软件需求分析及用例分析
    上海期货交易所数据备份软件项目前景与范围文档
    vmware虚拟机与主机连接
    c#实现截取电脑全屏
    求一串数组的最大的子数组的和 孔祥安AND杨霏
    多路电梯调度问题 杨霏AND孔祥安
    分析文件中频率出现最多的前十个词
  • 原文地址:https://www.cnblogs.com/oracle-ziyuhou/p/6086230.html
Copyright © 2011-2022 走看看