Solved

Oracle stored procedure - Select statement problem

Posted on 2006-07-01
2
1,285 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
  • 2
2 Comments
 
LVL 49

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 49

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating and Managing Databases with phpMyAdmin in cPanel.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now