Du skal vælge et bestemt felt for at indsætte resultatet, hvis du skal bruge det sådan.
declare or replace procedure select_row
(
bookingid in integer,
result out varchar2
) as
begin
select booking_name into result from booking where booking.id = bookingid;
end;
Ellers skal du først oprette en objekttype og vælge flere felter i objekttypen og returnere den. Du skal CREATE OBJECT eller CREATE RECORD.
CREATE OBJECT BOOKING_OBJ AS (
bookingid INTEGER
,booking_name VARCHAR2(128)
);
declare or replace procedure select_row
(
bookingid in integer,
result out BOOKING_OBJ
) as
begin
select booking_obj(bookingid, booking_name) into result from booking where booking.id = bookingid;
end;
Eller...
CREATE TYPE BOOKING_REC as record(
bookingid integer,
booking_name varchar2(100)
);
declare or replace procedure select_row
(
bookingid in integer,
result out BOOKING_REC
) as
begin
select bookingid, booking_name into result from booking where booking.id = bookingid;
end;
Alternativt kan du returnere en ref-markør.