# ExecuteQuery

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.Oracle/tree/main/Frends.Oracle.ExecuteQuery>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Query : `String`                | <p>Query to be executed in string format.</p><p><br>Default: <code>INSERT INTO MyTable (id, first\_name, last\_name) VALUES (:id, :first\_name, :last\_name)</code><br>Example: <code>"INSERT INTO MyTable (id, first\_name, last\_name) VALUES (:id, :first\_name, :last\_name)"</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Parameters : `QueryParameter[]` | <p>Parameters for the database query.</p><p><br>Default: <code>-</code><br>Example: <code>\[ { Name = "id", Value = 1, DataType = QueryParameterType.Int32 }, { Name = "first\_name", Value = "John", DataType = QueryParameterType.Varchar2 }, { Name = "last\_name", Value = "Doe", DataType = QueryParameterType.Varchar2 } ]</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 🗝ConnectionString : `String`   | <p>Oracle connection string.</p><p><br>Default: <code>Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT\_DATA=(SERVICE\_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;</code><br>Example: <code>Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT\_DATA=(SERVICE\_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ExecuteType : `ExecuteTypes`    | <p>Specifies how a command string is interpreted.</p><p>Auto: ExecuteReader for SELECT-query and NonQuery for UPDATE, INSERT, or DELETE statements.</p><p>ExecuteReader: Use this operation to execute any arbitrary SQL statements in Oracle if you want the result set to be returned.</p><p>NonQuery: Use this operation to execute any arbitrary SQL statements in Oracle if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.</p><p>Scalar: Use this operation to execute any arbitrary SQL statements in Oracle to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.</p><p>Possible values:</p><ul><li><code>Auto</code>:</li></ul><p>Specifies how a command string is interpreted.</p><p>Auto: ExecuteReader for SELECT-query and NonQuery for UPDATE, INSERT, or DELETE statements.</p><p>ExecuteReader: Use this operation to execute any arbitrary SQL statements in Oracle if you want the result set to be returned.</p><p>NonQuery: Use this operation to execute any arbitrary SQL statements in Oracle if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.</p><p>Scalar: Use this operation to execute any arbitrary SQL statements in Oracle to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.</p><ul><li><code>NonQuery</code>:</li></ul><p>Specifies how a command string is interpreted.</p><p>Auto: ExecuteReader for SELECT-query and NonQuery for UPDATE, INSERT, or DELETE statements.</p><p>ExecuteReader: Use this operation to execute any arbitrary SQL statements in Oracle if you want the result set to be returned.</p><p>NonQuery: Use this operation to execute any arbitrary SQL statements in Oracle if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.</p><p>Scalar: Use this operation to execute any arbitrary SQL statements in Oracle to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.</p><ul><li><code>Scalar</code>:</li></ul><p>Specifies how a command string is interpreted.</p><p>Auto: ExecuteReader for SELECT-query and NonQuery for UPDATE, INSERT, or DELETE statements.</p><p>ExecuteReader: Use this operation to execute any arbitrary SQL statements in Oracle if you want the result set to be returned.</p><p>NonQuery: Use this operation to execute any arbitrary SQL statements in Oracle if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.</p><p>Scalar: Use this operation to execute any arbitrary SQL statements in Oracle to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.</p><ul><li><code>ExecuteReader</code>:</li></ul><p>Specifies how a command string is interpreted.</p><p>Auto: ExecuteReader for SELECT-query and NonQuery for UPDATE, INSERT, or DELETE statements.</p><p>ExecuteReader: Use this operation to execute any arbitrary SQL statements in Oracle if you want the result set to be returned.</p><p>NonQuery: Use this operation to execute any arbitrary SQL statements in Oracle if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.</p><p>Scalar: Use this operation to execute any arbitrary SQL statements in Oracle to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.</p><p><br>Default: <code>0</code><br>Example: <code>ExecuteType.ExecuteReader</code></p> |
| {% endtab %}                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

{% tab title="Parameter: Options" %}

| Name                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ThrowErrorOnFailure : `Boolean`                    | <p>Choose if an error should be thrown if the Task fails.</p><p>Otherwise, returns Object { Success = false }</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| TimeoutSeconds : `Int32`                           | <p>Timeout value in seconds.</p><p><br>Default: <code>30</code><br>Example: <code>30</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| OracleIsolationLevel : `TransactionIsolationLevel` | <p>Transaction isolation level for the query.</p><p>Options:</p><p>- Default</p><p>- ReadCommited</p><p>- None</p><p>- Serializable</p><p>- ReadUncommited</p><p>- RepeatableRead</p><p>Additional information can be found from <a href="https://docs.oracle.com/cd/E25054_01/server.1111/e25789/consist.htm">here</a></p><p>Possible values:</p><ul><li><code>Default</code>:</li></ul><p>Transaction isolation level for the query.</p><p>Options:</p><p>- Default</p><p>- ReadCommited</p><p>- None</p><p>- Serializable</p><p>- ReadUncommited</p><p>- RepeatableRead</p><p>Additional information can be found from <a href="https://docs.oracle.com/cd/E25054_01/server.1111/e25789/consist.htm">here</a></p><ul><li><code>None</code>:</li></ul><p>Transaction isolation level for the query.</p><p>Options:</p><p>- Default</p><p>- ReadCommited</p><p>- None</p><p>- Serializable</p><p>- ReadUncommited</p><p>- RepeatableRead</p><p>Additional information can be found from <a href="https://docs.oracle.com/cd/E25054_01/server.1111/e25789/consist.htm">here</a></p><ul><li><code>ReadUncommitted</code>:</li></ul><p>Transaction isolation level for the query.</p><p>Options:</p><p>- Default</p><p>- ReadCommited</p><p>- None</p><p>- Serializable</p><p>- ReadUncommited</p><p>- RepeatableRead</p><p>Additional information can be found from <a href="https://docs.oracle.com/cd/E25054_01/server.1111/e25789/consist.htm">here</a></p><ul><li><code>ReadCommitted</code>:</li></ul><p>Transaction isolation level for the query.</p><p>Options:</p><p>- Default</p><p>- ReadCommited</p><p>- None</p><p>- Serializable</p><p>- ReadUncommited</p><p>- RepeatableRead</p><p>Additional information can be found from <a href="https://docs.oracle.com/cd/E25054_01/server.1111/e25789/consist.htm">here</a></p><ul><li><code>RepeatableRead</code>:</li></ul><p>Transaction isolation level for the query.</p><p>Options:</p><p>- Default</p><p>- ReadCommited</p><p>- None</p><p>- Serializable</p><p>- ReadUncommited</p><p>- RepeatableRead</p><p>Additional information can be found from <a href="https://docs.oracle.com/cd/E25054_01/server.1111/e25789/consist.htm">here</a></p><ul><li><code>Serializable</code>:</li></ul><p>Transaction isolation level for the query.</p><p>Options:</p><p>- Default</p><p>- ReadCommited</p><p>- None</p><p>- Serializable</p><p>- ReadUncommited</p><p>- RepeatableRead</p><p>Additional information can be found from <a href="https://docs.oracle.com/cd/E25054_01/server.1111/e25789/consist.htm">here</a></p><p><br>Default: <code>0</code><br>Example: <code>Default</code></p> |
| BindParameterByName : `Boolean`                    | <p>Choose to bind the parameter by name.</p><p>If set to false parameter order is crucial.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| EnableSafeNumericMapping : `Boolean`               | <p>When true, attempts to safely map high-precision Oracle numbers to .NET types</p><p>by rounding the scale. (Oracle can store up to 38 digits, while .NET only 29)</p><p>Note: Whole numbers exceeding 29 digits may still fail</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| {% endtab %}                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

{% tab title="Result: Result" %}

| Name                | Description                                                                                                                                                           |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean` | <p>Boolean value of success of the query<br>Example: <code>true</code></p>                                                                                            |
| Message : `String`  | <p>String value of the Error message that comes from Oracle.<br>Example: <code>"ORA-01722: invalid number"</code></p>                                                 |
| Output : `Object`   | <p>List of JObjects showing the output of the query.<br>Example: <code>\[{"ID": "1","FIRST\_NAME": "Saija","LAST\_NAME": "Saijalainen","START\_DATE": ""}]</code></p> |
| {% endtab %}        |                                                                                                                                                                       |

{% tab title="Changelog" %}

## Changelog

### \[4.0.0] - 2026-02-26

#### Fixed

* Fixed the issue with converting query results to JToken in Auto mode.

#### Added

* **\[Breaking Change]** Added an option to enable rounding of decimal values.

#### Changed

* Error related to parsing values is more descriptive now.
* **\[Breaking Change]** Normalize behavior between Auto and ExecuteReader mode.

### \[3.2.0] - 2025-03-25

#### Changed

* Update packages: Microsoft.Extensions.DependencyInjection 5.0.1 -> 9.0.3 Oracle.ManagedDataAccess.Core 3.21.170 -> 23.7.0 System.ComponentModel.Annotations 4.7.0 -> 5.0.0 coverlet.collector 3.1.0 -> 6.0.4 Microsoft.NET.Test.Sdk 16.6.1 -> 17.13.0 MSTest.TestFramework 2.2.8 -> 3.8.3 nunit 3.12.0 -> 4.3.2 NUnit3TestAdapter 3.17.0 -> 5.0.0

### \[3.1.0] - 2025-03-25

#### Fixed

* Fixed issue with converting query results to JToken.
* Updated Newtonsoft.Json to version 13.0.3.
* Updated Oracle.ManagedDataAccess.Core to version 3.21.170.

### \[3.0.0] - 2025-03-24

#### Added

* \[Breaking] New 'ExecuteType' parameter to control how SQL command string is executed.
* Default value for new parameter is 'Auto'
* Use the default parameter if you want the Task to work as before.

### \[2.0.1] - 2022-11-04

#### Fixed

* Fixed issue which resulted to task not able to close connection.

### \[2.0.0] - 2022-10-31

#### Fixed

* \[Breaking] Simplified implementation and merged ConnectionProperties and QueryProperties classes into one Input class.
* Changed the result output object to be dynamic to enable dot notation.
* Changed the implementation to resemble other database related tasks.
* Modified the task to be asynchronous.
* Changed the task use different methods when doing 'select' query and when doing other queries.
* Updated workflow for Linux based testing and enabled the tests.

### \[1.0.0] - 2022-04-22

#### Added

* Initial implementation.
  {% endtab %}
  {% endtabs %}
