You could write a stored procedure that had an OUT parameter that was a SYS_REFCURSOR
CREATE OR REPLACE PROCEDURE return_cursor( p_merch_id IN "Merch"."Id"%type,
p_order_ext IN "Order"."OrderExt"%type,
p_rc OUT sys_refcursor )
AS
BEGIN
OPEN p_rc
FOR SELECT "Merch"."Id", "Order"."Id", "Order"."OrderExt"
FROM "Order"
Join "Merch" ON "Order"."MerchId" = "Merch"."Id"
WHERE "Merch"."Id" = p_merch_id
AND "Order"."OrderExt" = p_order_ext;
END;
It would be more natural, however, to have a stored function that returned a SYS_REFCURSOR
CREATE OR REPLACE FUNCTION return_cursor( p_merch_id IN "Merch"."Id"%type,
p_order_ext IN "Order"."OrderExt"%type )
RETURN sys_refcursor
AS
l_rc sys_refcursor;
BEGIN
OPEN l_rc
FOR SELECT "Merch"."Id", "Order"."Id", "Order"."OrderExt"
FROM "Order"
Join "Merch" ON "Order"."MerchId" = "Merch"."Id"
WHERE "Merch"."Id" = p_merch_id
AND "Order"."OrderExt" = p_order_ext;
RETURN l_rc;
END;
As a general matter of style, having case-sensitive table and column names is very, very rarely a good idea. And having table names that match Oracle reserved words like Order is even less likely to be a good idea. Forcing every developer to always use double quotes around every identifier and to always specify them in the proper case is going to lead to substantially more mistakes than if you simply used the default case-insensitive convention and avoided reserved words.