Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

As I am new to this, I am facing some issue in executing stored procedure in oracle DB. Here is the SP which gives record as output parameter which is of type %rowtype and l_serno as input parameter which is of type Number.

SQL
Create OR Replace procedure get_product(l_serno in product.serno%type,record out product%rowtype)
is

begin

select * into record from product where serno=l_serno;

end get_product;




Using C#, I am trying to fetch the data from the SP and show it on the gridview.

C#
OracleCommand cmd = new OracleCommand("get_product", Conn);
                cmd.CommandType = CommandType.StoredProcedure;
                Conn.Open();
                OracleParameter input = cmd.Parameters.Add("V_SERNO", OracleType.Number);
                OracleParameter output = cmd.Parameters.Add("ITEMS_CURSOR", OracleType.Cursor);
                input.Direction = ParameterDirection.Input;
                output.Direction = ParameterDirection.ReturnValue;
                input.Value = 2;
                OracleDataReader rd = cmd.ExecuteReader();
                DataTable dt = new DataTable();
                dt.Load(rd);
                GridView1.DataSource = dt;
                GridView1.DataBind();
                Conn.Close();
<pre/>
Here I am getting error as 

<pre lang="vb">ORA-06550: line 1, column 24:

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

ORA-06550: line 1, column 7:



Please let me know what is the wrong I am doing here.
Thanks in Advance.
Posted
Updated 9-Sep-14 20:27pm
v2
Comments
Magic Wonder 10-Sep-14 2:50am    
Why don't you mention l_serno as integer instead of product.serno%type?
PrashanthJagannath 10-Sep-14 3:56am    
Thank you for your reply. I changed it to integer and it started working. I mentioned l_serno as product.serno%type so that it will take the datatype mentioned in the table.
Magic Wonder 10-Sep-14 5:14am    
Your welcome.

1 solution

Hi,

Change this...

Why don't you mention l_serno as integer instead of product.serno%type?


Hope this will help you.


Cheers
 
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