当找不到 ITEM_ID 时,我需要跳出循环或不执行循环:
BEGIN FOR item IN(SELECT ITEM.ITEM_ID, ITEM.ITEM_DESC, INVENTORY.INV_PRICE FROM ITEM INNER JOIN INVENTORY ON ITEM.ITEM_ID = INVENTORY.ITEM_ID WHERE ITEM.ITEM_ID = '1' ORDER BY ITEM.ITEM_ID, INVENTORY.INV_PRICE) LOOP DBMS_OUTPUT.PUT_LINE( item.ITEM_ID||' '||item.ITEM_DESC||' ' ||item.INV_PRICE); END LOOP; END;
另外,我需要打印出类似的东西DBMS_OUTPUT.PUT_LINE('Item not found!');