oracle - Converting mysql procedure to pl-sql procedure -
i trying convert mysql project pl/sql implement apex application. have problem converting stored procedure. working when using in mysql, gives error in pl/sql. have read pl/sql syntax, think have done necessary changes convert stored procedure pl/sql format.
my code following:
create or replace procedure findsuitableroom ( varbuilding_id in number, varlecture_block_id in number, varweek_of_the_day in number ) begin select a.room_id ( select room_id, room_number, r.building_id building inner join (select room.room_id, room_number, ruilding_id room inner join room_building_location on room.room_id=room_building_location.room_id) r on building.building_id=r.building_id r.building_id=varbuilding_id ) left join ( select room_id timetable timetable.lecture_block_id=varlecture_block_id , timetable.week_of_the_day=varweek_of_the_day ) b on a.room_id=b.room_id b.room_id null; end;
i think apex being oracle product should able convert mysql procedure pl/sql 1 , use in apex code. need return ref cursor shown in converted example below. here link post on oracle community website has additional example code apex related. need scroll down page has http://apex.oracle.com/pls/apex/f?p=34598:1
, see code below it
you should able use example code there , converted procedure below accomplish conversion.
create or replace package sample_ref_cursor_pkg type sample_ref_cursor ref cursor; end types; / create or replace procedure findsuitableroom ( varbuilding_id in number, varlecture_block_id in number, varweek_of_the_day in number ,out_cursor out sample_ref_cursor_pkg.sample_ref_cursor ) begin open out_cursor select a.room_id ( select room_id, room_number, r.building_id building inner join (select room.room_id, room_number, ruilding_id room inner join room_building_location on room.room_id=room_building_location.room_id) r on building.building_id=r.building_id r.building_id=varbuilding_id ) left join ( select room_id timetable timetable.lecture_block_id=varlecture_block_id , timetable.week_of_the_day=varweek_of_the_day ) b on a.room_id=b.room_id b.room_id null; end;
hope helps.
Comments
Post a Comment