Click here to Skip to main content
15,891,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i just need to create an SP which returns the count fo multiple tables.so i just defined the procedure like this,

--created my package like this

SQL
CREATE OR REPLACE PACKAGE COUNTTABLE AS
TYPE T_CURSOR IS REF CURSOR;
PROCEDURE SAMPLECOUNT
(
    cur_COUNT OUT T_CURSOR
);
END COUNTTABLE;

--defined the procedure like this

CREATE OR REPLACE PACKAGE BODY COUNTTABLE AS
PROCEDURE SAMPLECOUNT
(
    cur_COUNT OUT T_CURSOR
)
IS
BEGIN
    OPEN cur_COUNT FOR
    SELECT  (
        SELECT COUNT(*)
        FROM   PROJECTS
        ) AS count1,
        (
        SELECT COUNT(*)
        FROM   PROJECTS1
        ) AS count2
FROM    dual
END SAMPLECOUNT;
END COUNTTABLE;

while i am executing, its throwing me an error saying PL/SQL cannot find the program unit being called "MyDBA.Counttable. MyDBA is my database and counttable is the package. but in the SP if i specify to take the count of a single table instead of multiple tables, its working fine. i am new to this Oracle.so can anyone please help me in doing this.........?
Posted
Updated 16-Aug-12 17:46pm
v2

1 solution

Seems that either your call is wrong or you don't have the priviliges to execute the procedure.

If you're executring the procedure from outside the package, the call should be something like:
SQL
execute counttable.samplecount(the parameter for the cursor);

You may also need to define the owner schema if you don't have a public synonym for the package.
 
Share this answer
 
v2
Comments
Abdul Quader Mamun 17-Aug-12 1:15am    
good Answer!
Wendelius 17-Aug-12 1:24am    
Thank you :)
Abdul Quader Mamun 17-Aug-12 1:25am    
Please read my newly posted article and Plz comments or vote.
A Framework for Software Application[^]
Wendelius 17-Aug-12 1:31am    
I have to have a look at it when I have a proper moment :)
Abdul Quader Mamun 17-Aug-12 1:33am    
Ok, Great!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900