考虑以下代码:
String checkSeatQuery = "BEGIN USP_RESERVESEAT(IRESULT=>?, ICART_SESSION=>?, IEVENT_ID=>?, ISESSION_ID=>?, IPRICE_SCHEME_ID=>?, ISEAT_ID=>?, IBLOCK_ID=>?, INO_OF_SEAT=>?, IPOS=>?, ISOURCE=>?, IFLASH_SEAT_STATUS_KEY=>?); END;";
Query q = entityManager.createNativeQuery(checkSeatQuery);
q.setParameter(1, DataTypes.STRING); //value passed in: 1
q.setParameter(2, cartSessionId); //value passed in: BT71C49DD999300D33E70B69F0A43F3436
q.setParameter(3, tblEvent.getId()); //value passed in: 20
q.setParameter(4,null); //value passed in: null
q.setParameter(5, Integer.toString(tempTicket.getTblPriceSchemes().getId())); //value passed in: 366
q.setParameter(6, seatId); //value passed in: null
q.setParameter(7, blockId); //value passed in: null
q.setParameter(8, accumulatedSeat); //value passed in: 1
q.setParameter(9, pos); //value passed in: 1
q.setParameter(10, source); //value passed in: 1
q.setParameter(11, null); //value passed in: null
String outputs = (String) q.getResultList().get(0);
甲骨文程序:
DECLARE
IRESULT VARCHAR2(200);
ICART_SESSION VARCHAR2(200);
IEVENT_ID NUMBER;
ISESSION_ID NUMBER;
IPRICE_SCHEME_ID VARCHAR2(200);
ISEAT_ID VARCHAR2(200);
IBLOCK_ID NUMBER;
INO_OF_SEAT NUMBER;
IPOS NUMBER;
ISOURCE NUMBER;
IFLASH_SEAT_STATUS_KEY VARCHAR2(200);
BEGIN
ICART_SESSION := NULL;
IEVENT_ID := NULL;
ISESSION_ID := NULL;
IPRICE_SCHEME_ID := NULL;
ISEAT_ID := NULL;
IBLOCK_ID := NULL;
INO_OF_SEAT := NULL;
IPOS := NULL;
ISOURCE := NULL;
IFLASH_SEAT_STATUS_KEY := NULL;
USP_RESERVESEAT(
IRESULT => IRESULT,
ICART_SESSION => ICART_SESSION,
IEVENT_ID => IEVENT_ID,
ISESSION_ID => ISESSION_ID,
IPRICE_SCHEME_ID => IPRICE_SCHEME_ID,
ISEAT_ID => ISEAT_ID,
IBLOCK_ID => IBLOCK_ID,
INO_OF_SEAT => INO_OF_SEAT,
IPOS => IPOS,
ISOURCE => ISOURCE,
IFLASH_SEAT_STATUS_KEY => IFLASH_SEAT_STATUS_KEY
);
DBMS_OUTPUT.PUT_LINE('IRESULT = ' || IRESULT);
END;
我收到错误消息:
2012-05-10 15:45:16,267 WARN [org.hibernate.util.JDBCExceptionReporter] (http-localhost%2F127.0.0.1-8080-5) SQL Error: 6550, SQLState: 65000
2012-05-10 15:45:16,267 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-localhost%2F127.0.0.1-8080-5) ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'USP_RESERVESEAT'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'USP_RESERVESEAT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
这是为什么?在网络搜索后,我找不到太多有用的信息。
我正在使用以下内容:
Oracle,版本:Oracle Database 11g Release 11.1.0.0.0 - Production
Hibernate 3.3.2.GA
PL/SQL:
create or replace
PROCEDURE USP_RESERVESEAT
(
IRESULT OUT VARCHAR2
, ICART_SESSION IN VARCHAR2
, IEVENT_ID IN NUMBER
, ISESSION_ID IN NUMBER
, IPRICE_SCHEME_ID IN VARCHAR2
, ISEAT_ID IN VARCHAR2
, IBLOCK_ID IN NUMBER
, INO_OF_SEAT IN NUMBER
, IPOS IN NUMBER
, ISOURCE IN NUMBER
, IFLASH_SEAT_STATUS_KEY IN VARCHAR2
)as
Iprice_scheme_id_inv VARCHAR2 (3000);
Iseat_id_inv NUMBER;
Icheck NUMBER;
IPos1 NUMBER;
IPos2 NUMBER;
Icapacity NUMBER;
Itic_sold NUMBER;
Irv_cart NUMBER;
Irefund_tic NUMBER;
Irecord NUMBER;
Irecordc NUMBER;
Inew_seat NUMBER;
Iavailable VARCHAR2 (3000);
Istatus_name VARCHAR2 (3000);
Ilatest_seat_status_key VARCHAR2 (3000);
Ilatest_seat_status_name VARCHAR2 (3000);
Ichild NUMBER;
Itotal_child NUMBER;
Icount_row NUMBER;
Ipromo_quantity NUMBER;
Iis_package NUMBER;
Itocart_seat_id NUMBER;
Ilatest_flash_seat_id VARCHAR2 (3000);
Ipromo_tic NUMBER;
Iallotment NUMBER;
Iready_to_cancel NUMBER;
Iready_to_cancel_booking_id NUMBER;
IKILL NUMBER;
BEGIN
if (ISOURCE = '0') THEN
Istatus_name := 'Internet Reserved';
else
if (ISOURCE = '1') THEN
Istatus_name := 'POS Reserved';
else
if (ISOURCE = '2') THEN
Istatus_name := 'CS Reserved';
else
if (ISOURCE = '3') THEN
Istatus_name := 'Call Centre Reserved';
else
if (ISOURCE = '4') THEN
Istatus_name := 'Promoter Reserved';
end IF;
end IF;
end IF;
end IF;
end IF;
begin
INSERT INTO tbl_cart_session
( cart_session,
event_id,
price_scheme_id,
no_of_seat,
created_date
)
VALUES
(
Icart_session,
Ievent_id,
Iprice_scheme_id,
INO_OF_SEAT,
sysdate
);
update tbl_cart_session set created_date=sysdate where cart_session=Icart_session;
select '1' into Iresult from dual;
end;
END USP_RESERVESEAT;