Question

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

Was it helpful?

Solution

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top