CREATE OR REPLACE PROCEDURE book_tickets (flight_id IN VARCHAR2, traveler_id IN VARCHAR2, seating IN NUMBER)AS ticketsid “tickets”.“tickets_id” %TYPE; test_ticketsid NUMBER; test_cabin “tickets”.“cabin_rating” %TYPE; temp varchar(32); test_value NUMBER:=0;BEGIN --生成机票ID temp:=sys_guid(); ticketsid:= substr(temp,1,6)||substr(temp,28,4); --测试座位是否被预定 SELECT count(*) INTO test_ticketsid FROM “tickets” WHERE “seating_list” = seating; --查看结果 IF test_ticketsid = 0 THEN --座位未被预定 --判断仓位等级 test_value := seating/10; CASE WHEN test_value < 1 THEN test_cabin:=‘商务舱’; WHEN test_value < 2 THEN test_cabin:=‘二等舱’; ELSE BEGIN test_cabin:=‘经济舱’; END; END CASE; --预定机票 INSERT INTO “HKSP”.“tickets” VALUES (ticketsid, flight_id, traveler_id, seating, test_cabin, SYSDATE,1); DBMS_OUTPUT.PUT_LINE(‘预定成功’); ELSE --座位已被预定 DBMS_OUTPUT.PUT_LINE(‘座位已被预定’); END IF;END;
求大佬帮忙看一下
错误是创建的过程带有编译错误
2020-06-11
最新推荐文章于 2021-12-13 19:15:26 发布