0

When executing a oracle function from C# we are getting this error. please help to solve.

ORA-06550: line 1, column 15:

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

ORA-06550: line 1, column 7:

PL/SQL: Statement ignored

My c# code

comm.Connection = conn;
comm.CommandText = "LIVE.list_without_dublicates";
comm.CommandType = CommandType.StoredProcedure;

 comm.Parameters.Add("p_str", to_list);
comm.Parameters.Add("p_sep", ",");
comm.Parameters.Add("result", OracleDbType.Varchar2);
 comm.Parameters["result"].Direction = ParameterDirection.ReturnValue;

comm.ExecuteNonQuery();

Function signature

LIVE.list_without_dublicates(
p_str IN VARCHAR2,
p_sep IN VARCHAR2 DEFAULT ',')
RETURN VARCHAR2
8
  • 1
    Is the function name really list_without_dublicates and not list_without_duplicates ? Commented Oct 25, 2016 at 11:45
  • @GordonLinoff its list_without_dublicates only Commented Oct 25, 2016 at 11:46
  • Can you post your function body as well? Commented Oct 25, 2016 at 11:56
  • and what is 'to_list' in your c#? Commented Oct 25, 2016 at 11:59
  • You're adding parameter result comm.Parameters.Add("result", OracleDbType.Varchar2); and this is not parameter of function. Commented Oct 25, 2016 at 11:59

1 Answer 1

1

As far as I remember you have to specify the (max) length of an Varchar2 when it is the return value.

Try this one:

comm.Parameters.Add("result", OracleDbType.Varchar2, 4000, null, ParameterDirection.ReturnValue);

instead of

comm.Parameters.Add("result", OracleDbType.Varchar2);
comm.Parameters["result"].Direction = ParameterDirection.ReturnValue;

Also try

comm.CommandText = "BEGIN :result := LIVE.list_without_dublicates(:p_str, :p_sep); END;";
comm.CommandType = CommandType.Text;

instead of

comm.CommandText = "LIVE.list_without_dublicates";
comm.CommandType = CommandType.StoredProcedure;
Sign up to request clarification or add additional context in comments.

1 Comment

@Wernfriend thanks for ur answer..it also gave me same error..so i called the funcation with select functionname from dual and it worked..im upvoting ur answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.