---
title: "Call Oracle Function From .NET As Stored Procedure"  
description: "Call Oracle Function From .NET As Stored Procedure"  
author: "Anonymous User"  
published: 2013-06-11  
updated: 2013-06-12  
canonical: https://www.mindstick.com/forum/1038/call-oracle-function-from-dot-net-as-stored-procedure  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 1 minute  

---

# Call Oracle Function From .NET As Stored Procedure

Hi [Developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs), \
My [Function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) return following [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing)\
**"System.Data.OracleClient.OracleException: [ORA](https://www.mindstick.com/forum/159135/ora-00907-missing-right-parenthesis)-06550: line 1, [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) 7:" & vbLf & "PLS-00221: 'TESTING2' is not a [procedure](https://www.mindstick.com/forum/32/stored-procedure-return-datatype) or is undefined".** \
When I change it to do "[Select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) [testing](https://www.mindstick.com/articles/1849/role-of-testing-in-software-development)() from dual" and change CommandType to [Text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions), it works. What am I [missing](https://answers.mindstick.com/qa/52138/international-missing-children-s-day-2019-was-observed-on)?\

```
Dim oracleConn As OracleConnection = CreateConnection(<connection info here>)    Dim oracleCmd As New OracleCommand()    oracleCmd.Connection = oracleConn    'oracleCmd.CommandText = "SELECT TESTING2() FROM DUAL" 'this works    oracleCmd.CommandText = "TESTING2"   'this does not work    oracleCmd.CommandType = CommandType.StoredProcedure    'oracleCmd.ExecuteReader()  'also tried this    Dim tmpVar As String = oracleCmd.ExecuteScalar()create or replace FUNCTION testing2RETURN VARCHAR2AS      begin  return 'hello';end;
```

**\**Any help would be amazing thank you!\

## Replies

### Reply by AVADHESH PATEL

Hi Ezra,\
You can try as following \
replace your line of code from the following line of code \

```
Dim oracleConn As OracleConnection = CreateConnection(<connection info here>)Dim oracleCmd As New OracleCommand()oracleCmd.Connection = oracleConnoracleCmd.CommandText = "TESTING2"   oracleCmd.CommandType = CommandType.StoredProcedureDim prm = new OracleParameter("returnvalue", OracleType.VarChar)prm.Size = 1024prm.Direction = ParameterDirection.ReturnValueoracleCmd.Parameters.Add(prm)oracleCmd.ExecuteNonQuery()Console.WriteLine(prm.Value.ToString)
```

**\**I hope it resolve your problem.


---

Original Source: https://www.mindstick.com/forum/1038/call-oracle-function-from-dot-net-as-stored-procedure

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
