Page 1 of 1

Problem with inserting record using oracle object types

Posted: Wed 02 Mar 2005 14:22
by Chakradhar
Hi,

I am interested in buying OraDirect .NET Data Provider .
I have downloaded the trail version of OraDirect .NET 3.00 beta for .NET Framework 1.x to evaluate the product. But I am getting some exceptions.

I am listing down my requirement below

1. I have created a Oracle Object Type "TEMPLOYEE "

CREATE OR REPLACE TYPE TEMPLOYEE AS OBJECT (empid number, empname VARCHAR2(30), commission number, salary number);

2. I have created a table "PEOPLE "

CREATE TABLE PEOPLE (
EMPID INTEGER,
EMPNAME VARCHAR2 (50),
COMMISSION INTEGER,
SALARY INTEGER)

3. Created a procedure "ObjectProc" to insert a record into the table "Table"

CREATE OR REPLACE PROCEDURE ObjectProc(v_emp in TEMPLOYEE)
is
BEGIN
INSERT INTO people VALUES (v_emp.empid,v_emp.empname,v_emp.commission,v_emp.salary);
END ObjectProc;

4. Now I am trying insert the a record by calling the store Procedure from my DotNet application as below, But I am getting exception

OracleSelectCommand.CommandType = CommandType.StoredProcedure;
this.OracleSelectCommand.CommandText = "ObjectProc";

this.OracleSelectCommand.Connection = this.oracleConnection1;
this.OracleSelectCommand.Name = "OracleSelectCommand";

OracleParameter p1 = OracleSelectCommand.Parameters.Add("v_emp", "SCOTT.TEMPLOYEE");
p1.Value= 10;
p1.Value = "test";
p1.Value = 10;
p1.Value = 10;
this.OracleSelectCommand.ExecuteNonQuery();

It would be great if you can send me a sample code to insert record into table using oracle object types.

Posted: Sat 05 Mar 2005 15:18
by Oleg
This problem relates to version 3.0 beta only. It will be fixed in the release of OraDirect .NET Data provider. Meanwhile please use OraDirect 2.50 for your purpose.