使用编译错误创建的包

时间:2017-02-26 03:07:54

标签: php oracle codeigniter

我正在使用带有PHP codeigniter的Oracle 10g快速版。

我正在创建一个这样的包: -

CREATE OR REPLACE PACKAGE currentMovie
    IS
        PROCEDURE 
        currentMovieList (cdate IN VARCHAR2, movieList OUT SYS_REFCURSOR) 
        IS
          BEGIN
            OPEN movieList FOR
            SELECT * FROM tbl_movie, tbl_language WHERE tbl_movie.language_id = tbl_language.language_id AND TO_DATE(cdate, 'YYYY-MM-DD hh24:mi:ss') BETWEEN movie_sdate AND movie_edate;
          END currentMovieList
    END currentMovie;
/

我收到警告:Package created with compilation error

但是,当我像这样单独装箱时: -

CREATE OR REPLACE PROCEDURE 
        currentMovieList (cdate IN VARCHAR2, movieList OUT SYS_REFCURSOR) 
    IS
        BEGIN
            OPEN movieList FOR
            SELECT * FROM tbl_movie, tbl_language WHERE tbl_movie.language_id = tbl_language.language_id AND TO_DATE(cdate, 'YYYY-MM-DD hh24:mi:ss') BETWEEN movie_sdate AND movie_edate;
        END;
/

我没有收到任何错误。程序保存得很好。

我做错了什么?

1 个答案:

答案 0 :(得分:2)

首先,您需要在包中定义过程,如下所示。我们只是在PACKAGE上定义它。身体部位进入PACKAGE BODY。

{
private String name;
private String name2;
private String name3;
private String description;
private String description2;
private String description3;
    public Option (String name, String description, String name2, String description2, String name3, String description3)
    {
        this.name = name;
        this.name2 = name2;
        this.name3 = name3;
        this.description = description;
        this.description2 = description2;
        this.description3 = description3;
    }
    public String toString() //Responsibility: Returns a description of the option(Name, Description)
    {
        String options = "The first option for this car has " + name + description + ", the second option for this car has" + name2 + description2 + ","
        + " and the third option for this car has" + name3 + description3 + ".";
        return options;
    }
}

然后,您需要使用SQL> CREATE OR REPLACE PACKAGE currentMovie AS PROCEDURE currentMovieList (cdate IN VARCHAR2, movieList OUT SYS_REFCURSOR); END currentMovie; / Package created. 语句来创建存储包的主体。

CREATE PACKAGE BODY