How to open custom type from plsql in php?

I created a type in 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;

In plsql, I can access the attributes of the returned object by simply doing this:

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

But how can I access object attributes from php using OCI8

+3
source share
1 answer

First create a type of this object to return it as a table.

CREATE TYPE tableType AS TABLE OF myType

Then, using the Oracle table () function, you can treat the output as a normal choice in PHP

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

simple, huh? :)

(edited as requested for completeness)

+1
source

All Articles