【发布时间】: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