Search code examples
sqlplsqlrecord

Query pl/sql record type in a simple sql


I have a function in a package and it returns a user-defined record.

The record looks like:

type MyRecord is record (
    id varchar(15),
    start_date date
);

i want to call my function in a sql query. i tried this:

select id, start_date from (select mypackage.myfunc() from dual);

But it doesn't work. The main question is how can i call a stored function from a simple sql query. Any idea?


Solution

  • i think i've found the answer:

    select * from table(mypackage.myfunc());