Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can a Package function return table?

3558023Jun 14 2018 — edited Aug 7 2018

Hi all,

I got a set of data to display in a crystal report; But before the raw data be able to shown in crystal report, I have to massage the data via logic with insert and update statements to form my result table.

From MS SQL Server, there are stored procedure which I can write my own logic to interact with Tables or Values and if I end the stored procedure by a select statement, the SP can return the table result for me.

I knew that in Oracle, package act like stored procedure in MS SQL Server, but I dont know how to define the return type as a table in a package function....

I found the following materials for reference:

https://stackoverflow.com/questions/2829880/create-an-oracle-function-that-returns-a-table

But I only can get only 1 row, if i modified the SELECT statement that collect more than one row, the package can be compile but when I execute It will prompt error and said there are more than one row in result.

I also tried to use cursor and loop it, but still not working; May I ask can you guys give me some advise or help please?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2018
Added on Jun 14 2018
12 comments
1,742 views