Anda perlu memilih bidang tertentu untuk dimasukkan ke dalam hasil jika Anda akan menggunakannya seperti itu.
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;
Jika tidak, Anda harus membuat tipe objek terlebih dahulu, dan memilih beberapa bidang ke dalam tipe objek dan mengembalikannya. Anda harus BUAT OBYEK atau BUAT REKAM.
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;
Atau...
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;
Atau, Anda dapat mengembalikan kursor ref.