简体   繁体   中英

wrong number or types of arguments in call to

I have created a package successfully. But when I try to call this on my C# program I am getting an error: wrong number or types of arguments in call to LOG_STATUS

LOG_STATUS is the name of the procedure:

CREATE OR REPLACE PACKAGE BODY ITMON.SERVERSTATUS AS  
PROCEDURE LOG_STATUS(out_RESULT OUT sys_refcursor)   
IS 
BEGIN
OPEN out_RESULT FOR
    SELECT HOSTNAME, USERS, PS_NAME 
    FROM PS_COLLECT
    WHERE NOT EXISTS
( 
        SELECT HOSTNAME, USERS, PS_NAME
        FROM PS_MASTER
        WHERE PS_MASTER.HOSTNAME = PS_COLLECT.HOSTNAME 
        AND PS_MASTER.USERS = PS_COLLECT.USERS 
        AND PS_MASTER.PS_NAME = PS_COLLECT.PS_NAME
    );
 END LOG_STATUS;  
END;

Here is my C# Code:

            OracleCommand OCom = new OracleCommand("SERVERSTATUS.LOG_STATUS", oc);
            OCom.CommandType = CommandType.StoredProcedure;

            OCom.Parameters.Add("out_RESULT", OracleType.VarChar, 30000).Direction = ParameterDirection.Output;

            OCom.Parameters[0].Value = sid;

            OracleDataAdapter _daGrid1 = new OracleDataAdapter(OCom);

            _daGrid1.Fill(_dsGrid);

I found out what's wrong with my code..

Should change this line:

OCom.Parameters.Add("out_RESULT", OracleType.VarChar, 30000).Direction = ParameterDirection.Output;

to

OCom.Parameters.Add("out_RESULT", OracleType.Cursor).Direction = ParameterDirection.Output;

Should use Cursor instead of varchar..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM