Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Below is my code for fetching data from oracle-:

.Net statement------
C#
OracleConnection oracleConnection = new OracleConnection("----connectionstring----");
        OracleCommand cmd = new OracleCommand();
        // create the command for the stored procedure

        cmd.Connection = oracleConnection;
        cmd.CommandText = "REPORT.SP_SUBREPORT";
        cmd.CommandType = CommandType.StoredProcedure;


        //cmd.Parameters.Add("Id", OracleType.Number).Value = 26;
        cmd.Parameters.Add("Id", OracleType.Number).Value = 26;
        cmd.Parameters.Add("returndata", OracleType.Cursor).Direction =
            ParameterDirection.Output;


        OracleDataAdapter da = new OracleDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds);




Oracle query---:
SQL
CREATE OR REPLACE PACKAGE REPORT AS
TYPE T_CURSOR IS REF CURSOR;
PROCEDURE SP_SUBREPORT
(
    ScoreCardMetricId IN NUMBER,
    returndata OUT T_CURSOR
);
END REPORT;

CREATE OR REPLACE PACKAGE BODY REPORT AS
PROCEDURE SP_SUBREPORT
(
    ScoreCardMetricId IN NUMBER,
    returndata OUT T_CURSOR
)
IS
BEGIN
    OPEN returndata FOR
    SELECT    -----------long list of statement----WHERE     ID = Id ORDER BY ---statement----;

END SP_SUBREPORT;
END REPORT;



I am getting below error-:
{System.Data.OracleClient.OracleException (0x80131938): ORA-04063: 
ORA-06508: PL/SQL: could not find program unit being called: ""
ORA-06512: at line 1
Posted
Updated 23-Feb-15 22:40pm
v2
Comments
Rob Philpott 24-Feb-15 4:53am    
Just a guess, but don't you want to Open() the connection?
Kornfeld Eliyahu Peter 24-Feb-15 5:02am    
From the errors it seems that the package was not created at all or correctly - It seems to me a pure Oracle problem, not related to the C# code...

1 solution

After a quick Google for "PL/SQL: could not find program unit being called" it seems that the name you specified as a stored procedure could not be found in the database specified by the connection string.
 
Share this answer
 

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