Php 在oracle上的存储过程中返回单行

Php 在oracle上的存储过程中返回单行,php,sql,oracle,Php,Sql,Oracle,我正在使用php和oracle。 如何在存储过程中返回一行,以便像select查询一样使用,以便将它们读入php。 比如说 declare or replace procedure select_row ( bookingid in integer, result out varchar2 ) as begin select * into result from booking where booking.id = bookingid; end; 若要这样使用它,您需要选择一个特定的字段放

我正在使用php和oracle。 如何在存储过程中返回一行,以便像select查询一样使用,以便将它们读入php。 比如说

declare or replace procedure select_row 
(
bookingid in integer,
result out varchar2
) as 
begin
select * into result from booking where booking.id = bookingid;
end;

若要这样使用它,您需要选择一个特定的字段放入结果中

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;
否则,您需要首先创建一个对象类型,然后在对象类型中选择多个字段并返回该字段。您必须创建对象或创建记录

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;
或者


或者,您可以返回一个ref光标。

将“结果”去掉。否,
结果必须在那里
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;