--The array in oracle CREATE OR REPLACE TYPE idArray AS TABLE OF VARCHAR2(20);
--package header CREATE OR REPLACE PACKAGE Lib_Package AS PROCEDURE Book_Check_Procedure(ids IN idArray, exist OUT NUMBER); END Lib_Package;
--package body CREATE OR REPLACE PACKAGE BODY Lib_Package AS
PROCEDURE Book_Check_Procedure( ids IN idArray, exist OUT NUMBER) AS v_Index BINARY_INTEGER; BEGIN v_Index:= ids.FIRST; LOOP SELECT COUNT(*) INTO exist FROM Lib_Duplicate WHERE status='Lent' AND book_id=ids(v_Index); EXIT WHEN v_Index=ids.LAST OR exist>0; v_Index:= ids.NEXT(v_Index); END LOOP;END Book_Check_Procedure; END Lib_Package;