비슷한 조회에 대한 응답을 검토했지만 proc가 작성된 스키마를 추가하여 해결할 수없는 또 다른 오류가 계속 발생합니다. 다른 저장 프로 시저의 루프에서 저장 프로 시저 호출
이
내가 실행하려고하고있는 코드입니다 : 그것은 단지 숙제의 유일한 때문에이 같은 사용자가 이전에 작성한 다른 프로 시저를 호출하려고 시도하고있는 LOOP 문 내부create or replace procedure prcReturnDVD
-- define the parameters that this proc will accept
(memberid_in integer, dvd_in integer)
is
-- Define local variables
vNumRem number(2);
BEGIN
-- Update the rental table with the current date
update rental set rentalreturneddate = current_date where memberid = memberid_in and dvdid = dvd_in;
-- update DVD quantityonhand to reflect the return
update dvd set dvdquantityonhand = dvdquantityonhand + 1 where dvdid = dvd_in;
-- Check to see how many DVDs are available for rent for this member
select get_rentalsremaining(memberid_in) into vNumRem from dual;
-- Evaluate the next action depending on number of remaining DVD rentals available
if vNumRem >= 1 then
-- need to write a for loop in order to cycle through the DVDs that need to be shipped out
while vNumRem >= 0
loop
SYSTEM.prcShipNextDVD(memberid_in);
vNumRem := vNumRem - 1;
end loop;
elsif vNumRem = 0 then
-- message that no rentals are allowed
dbms_output.put_line('No more rentals allowed.');
end if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('No Data Returned, process failed.');
WHEN TOO_MANY_ROWS THEN
dbms_output.put_line('Too many rows returned into variable, check data and try again.');
WHEN OTHERS THEN
dbms_output.put_line('An unidentified error has occured. Please research issue with procedure.');
END;
/
(나는 시스템을 사용하고 있습니다 할당하고 권한을 단순화) :
create or replace procedure prcShipNextDVD
-- define the parameters that this proc will accept
(memberid_in integer)
is
-- Define local variables
vCountOut number(2);
vAllowedOut number(2);
vNextDvd number(16);
vAddedInQueue date;
vPlaceInQueue number(5);
BEGIN
-- ensure the member is eligible to take out another DVD at this time
-- See how many movies the member currently has out
select count(*) into vCountOut from rental where memberid = memberid_in and rentalreturneddate is null;
-- See how many movies the member is allowed to have out
select membershiplimitpermonth into vAllowedOut from membership m, member p where m.membershipid = p.membershipid and p.memberid = memberid_in;
IF vCountOut < vAllowedOut then
-- If the number out currently is less than the number allowed out currently
-- Get next DVD in queue available for shipment
select get_nextdvd(memberid_in) into vNextDVD, datedaddedinqueue into vAddedInQueue, rentalpriority into vPlaceInQueue from rentalqueue where memberid = memberid_in;
-- create new record in rental table for this shipment
insert into rental (rentalid, memberid, dvdid, rentalrequestdate, rentalshippeddate) values (rental_seq.nextval, memberid_in, vNextDVD, vAddedInQueue, current_date);
-- decrement dvdquantityon hand in dvd table
update dvd set quantityonhand = quantityonhand - 1 where dvdid = vNextDVD;
-- remove dvd from queue
delete from rentalqueue where memberid = memberid_in and dvdid = vNextDVD ;
-- manage remaining rentalpriority records by decrementing them properly (like in 2.1)
update rentalqueue set rentalpriority = rentalpriority - 1 where memberid = memberid_in and rentalpriority >= vPlaceInQueue;
ELSE
-- If the member already has the maximum number of movies out at this time
RAISE_APPLICATION_ERROR(-20101, 'Maximum number of movies out reached. You are not allowed to check out another movie at this time.');
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('No Data Returned, process failed.');
WHEN TOO_MANY_ROWS THEN
dbms_output.put_line('Too many rows returned into variable, check data and try again.');
WHEN OTHERS THEN
dbms_output.put_line('An unidentified error has occured. Please research issue with procedure.');
END;
/
나는 다음과 같은 오류가 발생하고 심지어 프로 시저 호출에 스키마 이름을 추가 한 후. 나는 또한 "실행"과 "호출"로 실행하려고했지만 제대로 작동하지 않는다는 것을 알고있다.
PROCEDURE PRCRETURNDVD compiled
Errors: check compiler log
19/7 PL/SQL: Statement ignored
19/14 PLS-00905: object SYSTEM.PRCSHIPNEXTDVD is invalid
내가 여기에 대해 잘못하고있는 것에 대한 다른 권장 사항은 무엇입니까?
내가 전화하는 절차에 문제가 있지만 컴파일이됩니다. (주석에 설명 된대로)
오라클은 동일한 프로 시저를 다른 매개 변수 목록으로 컴파일 할 수 있습니다. 따라서 동일한 절차의 여러 버전을 저장할 수 있습니다. 이를 오버로드라고합니다. 예를 들어, myadd (n1 pls_integer, n2 pls_integer) 및 myadd (n1 pls_integer, n2 pls_integer, n3 pls_integer)를 가질 수 있으며 Oracle은 두 버전의 프로 시저를 모두 유지합니다. 오류없이 컴파일 한 프로 시저가 호출하려는 매개 변수 유형과 동일한 매개 변수 유형을 가지고 있는지 확인하십시오. 문제 해결을 위해, 나는 단지 다른 proc에서가 아니라 SQL 커맨드 라인에서 하나의 저장된 proc을 호출하려고 시도 할 것이다. –
나는 이전에 일하는 부름을 받았지만 지금은 ... 부러진 것처럼 보입니다. -/ –
맞습니다. 두 번째 생각에, 아마도 여러 버전이 떠 다니는 것과 관련이 없을 것입니다. 이후로 나는 패키지 안에서만 과부하를 할 수 있다고 생각하지 않습니다. 컴파일 한 후에는 "show errors"명령을 사용하여 발생한 오류를 나열합니다. prcshipnextdvd의 컴파일이 깨끗하게 돌아 왔고 "show errors"도 깨끗합니다. –