【问题标题】:PL/SQL toolkit web application error when compiling procedure编译过程时 PL/SQL 工具包 Web 应用程序错误
【发布时间】:2015-12-19 17:38:29
【问题描述】:

我正在尝试基于教程示例开发 Web 应用程序。我创建了具有许多参数的过程 cilveki_list。当我编译这段代码时,我得到两个错误:

1)PL/SQL: SQL Statement ignored
2)PL/SQL: ORA-00933: SQL command not properly ended

第一个错误是指行'c_kods in varchar2 default null' 第二个是' if p_action = 'INSERT' then'。

过程行为取决于参数'p_action',如果设置为'INSERT',则执行插入,如果设置为'UPDATE',则执行表更新。

但是 porcedue 有什么问题,为什么我在尝试编译时会出现这些错误?

create or replace package PACKAGE2 is
procedure cilveki_list(
c_vards in char default null,
c_uzvards in char default null,
c_dzimsanas_gads in number default null,
c_kods in varchar2 default null,
p_action in varchar2 default 'DISPLAY');
end PACKAGE2;
/

create or replace package body PACKAGE2 is

procedure cilveki_list(
c_vards in char default null,
c_uzvards in char default null,
c_dzimsanas_gads in number default null,
c_kods in varchar2 default null,
p_action in varchar2 default 'DISPLAY')
is
l_count number := 0;
begin
if p_action = 'INSERT' then
insert into CILVEKI
values ('',c_vards,c_uzvards,c_dzimsanas_gads,c_kods);
commit;

elsif p_action = 'UPDATE' then  
    UPDATE CILVEKI 
        set VARDS = c_vards,    
            UZVARDS = c_uzvards,
            DZIMSANAS_GADS = c_dzimsanas_gads
        WHERE   PERS_KODS =  c_kods;
        commit;
    end if;

htp.htmlOpen;
htp.bodyOpen;
htp.tableOpen;
htp.tableRowOpen;
htp.tableHeader('VARDS');
htp.tableHeader('UZVARDS');
htp.tableHeader('DZIMSANAS_GADS');
htp.tableHeader('PERS_KODS');
htp.tableRowClose;

for c1 in (select VARDS, UZVARDS, DZIMSANAS_GADS,PERS_KODS
             from CILVEKI
            order by UZVARDS) loop
    htp.tableRowOpen;
    htp.tableData( 
        htf.anchor( 
          curl => 'cilveki_modify?p_action=UPDATE&p_ticker=' || c1.VARDS,
          ctext => c1.VARDS) );
    htp.tableData( c1.UZVARDS );
    htp.tableData( c1.DZIMSANAS_GADS );
    htp.tableData( c1.PERS_KODS );
    htp.tableRowClose;
    l_count := l_count + 1;
end loop;

htp.tableClose;
htp.p( l_count || ' rows found');
htp.anchor( curl => 'cilveki_modify?p_action=INSERT', 
            ctext => 'Create New' );
htp.bodyClose;
htp.htmlClose;
end cilveki_list;
end PACKAGE2;
/

【问题讨论】:

    标签: plsql package procedure toolkit


    【解决方案1】:
    UPDATE CILVEKI 
    set VARDS = c_vards,    
        UZVARDS = c_uzvards,
        DZIMSANAS_GADS = c_dzimsanas_gads,
    WHERE PERS_KODS =  c_kods
    commit;
    

    上面的第 4 行似乎无效。行尾不应有逗号。请去掉逗号,重新编译代码。

    【讨论】:

    • 感谢您的回复,我修改了我的代码并提出了问题。现在我收到其他错误
    • 再次修改代码,现在我得到 'Error(1,14): PLS-00304: cannot compile body of 'PACKAGE2' without its specification'
    • 包装规格是否处于有效状态?或者,它甚至是被创造出来的吗?
    • 谢谢,解决了,有sintax错误
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-23
    • 1970-01-01
    • 2015-02-10
    • 2011-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多