Вопрос

I have created a type on Oracle

CREATE OR REPLACE TYPE  myType as object (
id number,rol varchar(16) );​

Then I have this function that returns an object of type myType

create or replace FUNCTION myFunction(...) RETURN myType IS
.... 
END;

On plsql I can access the attributes of the returned object just doing this:

var := myFunction(...);
dbms_output.put_line(var.rol);

But how can I have access to the object attributes from php using OCI8

Это было полезно?

Решение

First create a type of that object to be able to return it as a table.

CREATE TYPE tableType AS TABLE OF myType

Then, using Oracle's table() function you can handle the output as a normal select on PHP

select *
from   table(myFunction(...))

simple, huh? :)

(edited as requested for completeness)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top