Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Oracle stored procedure - Select statement problem

Posted on 2006-07-01
2
Medium Priority
?
1,337 Views
Last Modified: 2008-03-10
hi

I'm new to the oracle. I'm created the following SP in oracle but it gives error

CREATE OR REPLACE  PROCEDURE "SYSTEM"."SMS_SELECTEMPLOYEE"  is  
 BEGIN
   SELECT * from EMPTable
END;

plz  guide me how to return the all the records using oracle sp

thanks and regards
mk_mur

0
Comment
Question by:mk_mur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 17023516
I think you need to create a package with a Cursor, try:

CREATE OR REPLACE PACKAGE MYPACKAGE AS
    TYPE my_cur IS REF CURSOR;
    FUNCTION getListFund RETURN my_cur;
    FUNCTION getListMain RETURN my_cur;
    FUNCTION getListGeo RETURN my_cur;
    FUNCTION getListSpecial RETURN my_cur;
    FUNCTION getLastUpdatedDate RETURN my_cur;    
END;
/


CREATE OR REPLACE  PROCEDURE "SYSTEM"."SMS_SELECTEMPLOYEE"
(p_cursor OUT MYPACKAGE.my_cur)
AS
BEGIN
    OPEN p_cursor FOR
    SELECT * from EMPTable;
END;
/
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 150 total points
ID: 17023518
oops, should be simple as this....

CREATE OR REPLACE PACKAGE MYPACKAGE AS
    TYPE my_cur IS REF CURSOR;
END;
/


CREATE OR REPLACE  PROCEDURE "SYSTEM"."SMS_SELECTEMPLOYEE"
(p_cursor OUT MYPACKAGE.my_cur)
AS
BEGIN
    OPEN p_cursor FOR
    SELECT * from EMPTable;
END;
/
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question