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!

Stored Procedure Returning Result Set

3234063May 9 2016 — edited May 9 2016

I am trying to create a stored procedure that will be passed two varchar2(20) variables and return a result set. This is something I can do very easily in MS SQL but I can't seem to get the syntax right in Oracle. I am using Oracle 11.

My select statement is similar to the following.

WITH T AS (

SELECT

PRODUCT_LINE_1

,PRODUCT_LINE_2

,PRODUCT_LINE_3

from Table_Name where formula = @f and version = @v)

SELECT val

FROM T

UNPIVOT INCLUDE NULLS (val FOR ord in(

PRODUCT_LINE_1 AS 7

,PRODUCT_LINE_2 AS 8

,PRODUCT_LINE_3 AS 9

))

ORDER BY ord

Please also provide me the SQL statement I would use to execute it.

Thanks,

Scott

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2016
Added on May 9 2016
6 comments
12,525 views