Solved

Oracle stored procedure - Select statement problem

Posted on 2006-07-01
2
1,327 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 52

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 52

Accepted Solution

by:
Ryan Chong earned 50 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

751 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