Call Oracle Stored Procedure with Char Out Parameter errors with PLS-00306: wrong number or types of arguments in call

user2896050

I have the following Oracle Stored Procedure:

PROCEDURE SP_ITEMEXISTS(pID IN NUMBER, pExists OUT CHAR) IS
BEGIN
        select CASE count(*) WHEN 0 THEN 'N' ELSE 'Y' END into pExists from items where id = pID;
END SP_ITEMEXISTS;

I'm calling it from Enterprise Library 6.0 with ODP.NET with the following code:

    public bool ItemExists(int itemID)
    {
        string procedureName = "SP_ItemExists";
        var database = new DatabaseProviderFactory().CreateDefault();
        bool returnValue = false;

        using (OracleCommand command = (OracleCommand)database.GetStoredProcCommand(procedureName))
        {
            command.Parameters.Add("pID", OracleDbType.Int32, itemID, ParameterDirection.Input);
            command.Parameters.Add("pExists", OracleDbType.Char, ParameterDirection.Output);

            using (OracleDataReader reader = ((OracleDataReaderWrapper)database.ExecuteReader(command)).InnerReader)
            {
                char exists = reader.GetChar("pExists");

                if (exists.ToString().ToUpper() == "Y")
                    returnValue = true;
                else
                    returnValue = false;
            }
        }

        return returnValue;

    }

I receive the following error: ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of arguments in call to 'SP_ITEMEXISTS'\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored

I have other stored procedures that I can call successfully, but the others have a refcursor OUT parameter. How do I call it when the OUT type is Char?

Wernfried Domscheit

ExecuteReader is used only for RefCursor as you found out already. Use database.ExecuteNonQuery() for calling a procedure or function. Read out return values with command.Parameters("pExists").Value

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Using Default Parameter in Stored Procedure call

From Dev

PL/SQL: Error "PLS-00306: wrong number or types of arguments in call to" triggered for table of numbers

From Dev

oracle Stored Procedure with Out parameter

From Dev

Getting wrong number or types of arguments in call to exception while executing stored procedure

From Dev

IBM Worklight - How to call a Stored Procedure with the "OUT" parameter?

From Dev

PLS-00306: wrong number or types of arguments in call to 'OUTPUT_ARRAY'

From Dev

How to call a stored procedure with a parameter of type table

From Dev

passing PHP array to Oracle Stored Proc (PLS-00306: wrong number or types of arguments)

From Dev

Oracle procedure call results in "PLS-00306: wrong number or types of arguments in call"

From Dev

Call stored procedure with user defined parameter

From Dev

Access Call Stored Procedure with Pass Through Parameter

From Dev

Pass array as input parameter to an oracle stored procedure using simple jdbc call

From Dev

How to call MySQL stored procedure with OUT parameter in Laravel

From Dev

nPLS-00306: wrong number or types of arguments in call

From Dev

Python - pyodbc call stored procedure with parameter name

From Dev

How can I call an Oracle stored procedure with object parameter for input in c#?

From Dev

Call oracle stored procedure with oracle object parameter

From Dev

PLS-00306: wrong number or types of arguments in call to 'CREATE_PROGRAM'

From Dev

How to call Oracle Procedure which has one OUT parameter

From Dev

Oracle stored procedure call with provided/default parameters

From Dev

Call stored procedure with user defined parameter

From Dev

Access Call Stored Procedure with Pass Through Parameter

From Dev

how to call oracle stored procedure in jpa2.0 which returns integer as out variable

From Dev

Wrong number or types of arguments in call to even after correct parameters

From Dev

How to call MySQL stored procedure with OUT parameter in Laravel

From Dev

Oracle Stored Procedure PLS-00306: wrong number or types of arguments

From Dev

PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'

From Dev

Oracle Procedure - PLS-00306: wrong number or types of arguments

From Dev

how to call oracle procedure that has in out cursor

Related Related

  1. 1

    Using Default Parameter in Stored Procedure call

  2. 2

    PL/SQL: Error "PLS-00306: wrong number or types of arguments in call to" triggered for table of numbers

  3. 3

    oracle Stored Procedure with Out parameter

  4. 4

    Getting wrong number or types of arguments in call to exception while executing stored procedure

  5. 5

    IBM Worklight - How to call a Stored Procedure with the "OUT" parameter?

  6. 6

    PLS-00306: wrong number or types of arguments in call to 'OUTPUT_ARRAY'

  7. 7

    How to call a stored procedure with a parameter of type table

  8. 8

    passing PHP array to Oracle Stored Proc (PLS-00306: wrong number or types of arguments)

  9. 9

    Oracle procedure call results in "PLS-00306: wrong number or types of arguments in call"

  10. 10

    Call stored procedure with user defined parameter

  11. 11

    Access Call Stored Procedure with Pass Through Parameter

  12. 12

    Pass array as input parameter to an oracle stored procedure using simple jdbc call

  13. 13

    How to call MySQL stored procedure with OUT parameter in Laravel

  14. 14

    nPLS-00306: wrong number or types of arguments in call

  15. 15

    Python - pyodbc call stored procedure with parameter name

  16. 16

    How can I call an Oracle stored procedure with object parameter for input in c#?

  17. 17

    Call oracle stored procedure with oracle object parameter

  18. 18

    PLS-00306: wrong number or types of arguments in call to 'CREATE_PROGRAM'

  19. 19

    How to call Oracle Procedure which has one OUT parameter

  20. 20

    Oracle stored procedure call with provided/default parameters

  21. 21

    Call stored procedure with user defined parameter

  22. 22

    Access Call Stored Procedure with Pass Through Parameter

  23. 23

    how to call oracle stored procedure in jpa2.0 which returns integer as out variable

  24. 24

    Wrong number or types of arguments in call to even after correct parameters

  25. 25

    How to call MySQL stored procedure with OUT parameter in Laravel

  26. 26

    Oracle Stored Procedure PLS-00306: wrong number or types of arguments

  27. 27

    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'

  28. 28

    Oracle Procedure - PLS-00306: wrong number or types of arguments

  29. 29

    how to call oracle procedure that has in out cursor

HotTag

Archive