Oracle Stored Procedure, Returning Ref Cursor Help

Hello,

I am wanting to return a set of records from a stored procedure back out to my web service.  I am sending in a parameter, running the query off that parameter and need to return th resulting recordset.  However, it will not compile.  Any help would be appreciated.  Thanks
CREATE OR REPLACE PROCEDURE get_conflict_points(psourcepipelinenumber IN VARCHAR2,   result_cursor OUT) AS

BEGIN

  OPEN result_cursor FOR

  SELECT a.station,
    a.station_piping_junction,
    psourcepipelinenumber AS
  current_pipeline_to_check,
    c.pipeline,
    c.ps_nass_pipeline
  FROM sch_cor_stations a,
    sch_fie_pipelines b,
    sch_fie_pipeline_sources c
  WHERE a.pipeline = psourcepipelinenumber
   AND a.station_piping = 1
   AND a.station_piping_scheduled = 1
   AND b.junction = a.station_piping_junction
   AND b.tank_scheduling_station = a.station
   AND b.has_pipeline_sources = 1
   AND c.ps_nass_station = a.station
   AND c.ps_nass_pipeline <> psourcepipelinenumber
  ORDER BY a.order_number;

END get_conflict_points;

Open in new window

jmpattonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Try below.  You need a datatype for the output parameter.

also Oracle hates blank lines so I removed one.
CREATE OR REPLACE PROCEDURE get_conflict_points(psourcepipelinenumber IN VARCHAR2,   result_cursor OUT sys_refcursor) AS

BEGIN

  OPEN result_cursor FOR
  SELECT a.station,
    a.station_piping_junction,
    psourcepipelinenumber AS
  current_pipeline_to_check,
    c.pipeline,
    c.ps_nass_pipeline
  FROM sch_cor_stations a,
    sch_fie_pipelines b,
    sch_fie_pipeline_sources c
  WHERE a.pipeline = psourcepipelinenumber
   AND a.station_piping = 1
   AND a.station_piping_scheduled = 1
   AND b.junction = a.station_piping_junction
   AND b.tank_scheduling_station = a.station
   AND b.has_pipeline_sources = 1
   AND c.ps_nass_station = a.station
   AND c.ps_nass_pipeline <> psourcepipelinenumber
  ORDER BY a.order_number;

END get_conflict_points;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmpattonAuthor Commented:
Thanks for the Quick response
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.