Solved

Oracle stored procedure - Select statement problem

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

615 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