We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
CREATE OR REPLACE FUNCTION get_total(customer_num IN customer.CustomerID%TYPE) RETURN NUMBER IS v_price MotelRoom.PRICE%TYPE; v_nights INTEGER; total_price NUMBER; BEGIN SELECT mr.price, TO_DATE(checkout, 'dd') - TO_DATE(checkin, 'dd') INTO v_price, v_nights FROM MotelRoom mr JOIN BookedRoom b ON mr.roomID = b.roomID WHERE b.customerID = customer_num; total_price := v_price * v_nights; RETURN total_price; EXCEPTION WHEN OTHERS THEN RAISE_APPLICATION_ERROR(-20001, 'There was an error when get_total function was run. ' || SQLCODE || ', ' || SUBSTR(SQLERRM, 1, 200)); END; /
Join the community of 500,000 technology professionals and ask your questions.