- 3,716,133 Users
- 2,242,960 Discussions
- 7,845,840 Comments
Forum Stats
Discussions
Categories
- 17 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 1.6K Databases
- 479 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 22 Multilingual Engine
- 487 MySQL Community Space
- 5 NoSQL Database
- 7.6K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 417 SQLcl
- 42 SQL Developer Data Modeler
- 184.9K SQL & PL/SQL
- 21K SQL Developer
- 1.9K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.1K Development Tools
- 9 DevOps
- 3K QA/Testing
- 259 Java
- 6 Java Learning Subscription
- 11 Database Connectivity
- 67 Java Community Process
- 1 Java 25
- 9 Java APIs
- 141.1K Java Development Tools
- 6 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 10 Java SE
- 13.8K Java Security
- 3 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 125 LiveLabs
- 31 Workshops
- 9 Software
- 3 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 4 Deutsche Oracle Community
- 11 Español
- 1.9K Japanese
- 2 Portuguese
ODP.Net Core Beta 3 with .Net Core and Dapper fails to pass and receive certain data types to Oracle

Environment:
- .Net Core v.2.1
- Dapper ORM v.1.50.5
- Oracle ODP.Net Beta:3
Problem:
1. Passing variable and receiving objects from/to Oracle SP:
a. ODP.Net does not seem to provide support for OracleDbTypes like
- NUMBER
- TABLE, etc.
- It throws the error "wrong number of types or arguments". Even when I am passing the exact number of input and output parameters with exact names.
b. The stored procedures on the other side are just receiving datatypes like NUMBER and are returning multiple TABLES as output parameter.
Code:
1. How I am including the parameters in the command:
var sql = OracleStoredProcedures.ValidateZipcode;
var parameters = new OracleDynamicParameters();
parameters.Add("id_sth", OracleDbType.Int32, ParameterDirection.Input, zipcode);
parameters.Add("id_sth2", OracleDbType.Int32, ParameterDirection.Input, zipcode);
parameters.Add("input_str", OracleDbType.Varchar2, ParameterDirection.Input, "random string");
parameters.Add("tdata", OracleDbType.RefCursor, ParameterDirection.Output);
parameters.Add("tdata2", OracleDbType.RefCursor, ParameterDirection.Output);
//parameters.Add("success_ful", OracleDbType.Varchar2, ParameterDirection.Output);
//parameters.Add("error_message", OracleDbType.Varchar2, ParameterDirection.Output);
var reader = SqlMapper.QueryMultiple(_unitOfWork.GetConnection(),
"TEST", parameters, commandType: CommandType.StoredProcedure);
//var success = reader.Read<bool>();
var result = reader.Read<Object>();
var result2 = reader.Read<Object>();
var result3 = reader.Read<string>();
**This code works when the SP is returning type REFCURSOR but it does not work on the SP's that are returning the TABLE on the same exact query.**
I am new to using Oracle with .net any help will be highly appreciated.
Thank you
Best Answer
-
The Oracle TABLE type is a user-defined type, which is currently not supported by ODP.NET Core. The TABLE type will not be supported in the first production release.
Answers
-
The Oracle TABLE type is a user-defined type, which is currently not supported by ODP.NET Core. The TABLE type will not be supported in the first production release.
-
Hi Alex, Thank you so much for the response and your time. We have many clients who have been using Oracle since ever and are willing to move to .net core for API.
I was wondering what would be the best practice for .net core currently.
My limited knowledge of ODP.Net Core the only currently supported type that returns collection is REF-CURSOR.
Given that we have REF-CURSOR supported, Is it a better practice to return the output as a single OUTPUT of type REF-CURSOR with values like BOOLEAN and STRING (VARCHAR) and COLLECTION(REF_CURSOR) wrapped inside the all encompassing REF-CURSOR.
Or is it a better practice to return multiple OUTPUTS of type BOOLEAN and STRING(VARCHAR) along with COLLECTION(REF-CURSOR).
It might be too much to ask in the forum. Any suggestions or thought or If you can please point me to any resources it would be really really helpful.
Thank you for your time
-
You can use associative arrays in ODP.NET Core. However, these arrays only can store scalar data types, which means no REF Cursor. No other collection type is supported in ODP.NET Core.
-
Thank you Alex. Really appreciate it.