如何编写存储过程以将jsp页面上的html表中的多行插入到oracle数据库中。 我已经按照以下方式编写了一个程序,但它无法正常工作:
create or replace procedure insert_service_detail(
p_challandetailid in cm_challan_details.challandetailsid%type,
p_challanid in cm_challan_details.challanid%type,
p_serviceid in cm_challan_details.serviceid%type,
p_year in cm_challan_details.year%type,
p_month in cm_challan_details.month%TYPE,
p_fee in cm_challan_details.fee%type,
p_cess in cm_challan_details.cess%type,
p_penalty in cm_challan_details.penalty%type,
p_total in cm_challan_details.total%type) as
begin
insert into CM_CHALLAN_DETAILS(challanid, serviceid, year, month, fee, cess, penalty, total)
values(p_challandetailid, p_challanid, p_serviceid, p_year, p_month, p_fee, p_cess, p_penalty, p_total);
end insert_service_detail;
答案 0 :(得分:1)
我找到了问题的答案,
create or replace PROCEDURE INSERT_DETAILS
(
p_challanid in table1.CHALLANID%type,
p_ulbid in table1.ulbid%type,
p_challanno in table1.CHALLANNO%type,
p_challanDate in table1.CHALLANDATE%type,
p_createdby in table1.CREATEDBY%type,
p_createdon in table1.CREATEDON%type,
p_finyearid in table1.FINYEARID%type,
p_challanstatus in table1.CHALLANSTATUS%TYPE,
p_name in table2.APPLICANTNAME%type,
p_addr in table2.APPLICANTADDRESS%type,
p_email in table2.APPLICANTEMAIL%type,
p_mobile in table2.MOBILENO%type,
p_contact in table2.CONTACTNO%type,
p_challandetailid in table3.challandetailid%type,
p_details_challanid in table3.CHALLANID%type,
p_serviceid in table3.serviceid%type,
p_year in table3.year%type,
p_month in table3.month%TYPE,
p_fee in table3.fee%type,
p_cess in table3.cess%type,
p_penalty in table3.penalty%type,
p_total in table3.total%type
)
AS
BEGIN
insert into table1(challanid, ulbid, challanno, CHALLANDATE, createdby, createdon, finyearid, CHALLANSTATUS) VALUESVALUES( 2, 1002, 'chln02', p_challandate, 'asdasd', to_date('02/03/2015', 'dd/mm/yyyy'), 10002, 'Y');
insert into table2(challinid, APPLICANTNAME, APPLICANTADDRESS, APPLICANTEMAIL, MOBILENO, CONTACTNO) values( 2, 2, 'abcd', p_addr, p_email, p_mobile, p_contact);
insert into table3( challandetailid, challanid, serviceid, year, month, fee, cess, penalty, total) values( 2, 102, 2, p_year, p_month, 10.25, 0.25, 0.1, 10.61);
commit;
END INSERT_CHALLAN_DETAILS;
我将此值插入数据库并插入3个表....
答案 1 :(得分:0)
INSERT查询中的参数数量不匹配..请检查。