# While executing the DB query getting error

**URL:** <https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308>\
**Category:** Studio\
**Tags:** workflow-diff, question, studio, database, activities\
**Created:** [April 4, 2022, 9:03am UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308 "2022-04-04T09:03:41Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 4, 2022, 9:03am UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/1 "2022-04-04T09:03:41Z")

</div>

Hello Community,

I’m getting the below error while executing the DB query, the connection was successful but while executing the query I’m getting the error.

The same query when I executed from Oracle its working fine.  
Can anyone please guide me the issues which I’m facing.

Error - A value of type ‘System.DBNull’ cannot be set to the location with name ‘out’ because it is a location of type ‘System.String’.

---

<div class="post-metadata">

**Author:** ![sarathi125](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sarathi125/32/519448_2.png) [@sarathi125](https://forum.uipath.com/u/sarathi125)\
**Post date:** [April 4, 2022, 9:30am UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/2 "2022-04-04T09:30:59Z")

</div>

@rupali2.deshmukh ,

You are trying to send a null for a column is not accepting null values in the database. Instead of sending a empty string you need to pass DB null value for that param.

Debug and get the query from UiPath and try to execute that from SQL, then you will get the actual issue.

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 4, 2022, 10:14am UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/3 "2022-04-04T10:14:18Z")

</div>

> [@sarathi125](#):
>
> d get the query from UiPath an

I have tested its working fine in the SQL. Its a simple query for retrieving the data for e.g. Select \* from DB.  
Only issue is while executing with UiPath.

---

<div class="post-metadata">

**Author:** ![vkalra](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vkalra/32/186364_2.png) [@vkalra](https://forum.uipath.com/u/vkalra)\
**Post date:** [April 4, 2022, 10:49am UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/4 "2022-04-04T10:49:11Z")

</div>

Hi @rupali2.deshmukh , Is this a select query? Because the error says that you are trying to set a null value. Are you saying that the select query is failing ? What is the output of the select query? What are the data types?

---

<div class="post-metadata">

**Author:** ![shreyash\_shirbhate](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/shreyash_shirbhate/32/205441_2.png) [@shreyash\_shirbhate](https://forum.uipath.com/u/shreyash_shirbhate)\
**Post date:** [April 4, 2022, 11:47am UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/5 "2022-04-04T11:47:41Z")

</div>

> [@rupali2.deshmukh](#):
>
> A value of type ‘System.DBNull’ cannot be set to the location with name ‘out’ because it is a location of type ‘System.String’.

Hi @rupali2.deshmukh , Can you please restart the UiPath and do the connection again.

Also make sure to use the latest version of UiPath.Database.

I hope this will help, thanks.

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 5, 2022, 12:11pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/6 "2022-04-05T12:11:39Z")

</div>

> [@vkalra](#):
>
> Hi @rupali2.deshmukh , Is this a select query? Because the error says that you are trying to set a null value. Are you saying that the select query is failing ? What is the output of the select query? What are the data types?

Yes, select query is failing. Its simple select query and output will be in terms of data table.

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 5, 2022, 12:16pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/7 "2022-04-05T12:16:07Z")

</div>

I did the steps but still I’m getting the same issue.  
Can you please suggest the way to move forward.

---

<div class="post-metadata">

**Author:** ![shreyash\_shirbhate](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/shreyash_shirbhate/32/205441_2.png) [@shreyash\_shirbhate](https://forum.uipath.com/u/shreyash_shirbhate)\
**Post date:** [April 5, 2022, 12:23pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/8 "2022-04-05T12:23:50Z")

</div>

Can you please paste the query here? if possible? @rupali2.deshmukh

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 5, 2022, 12:47pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/9 "2022-04-05T12:47:09Z")

</div>

Below is the query.

Select \* From empmaker\_ar\_head Where sys\_ar\_no =‘802004400045’

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [April 5, 2022, 12:51pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/10 "2022-04-05T12:51:33Z")

</div>

> [@rupali2.deshmukh](#):
>
> Select \* From empmaker\_ar\_head Where sys\_ar\_no =‘802004400045’

Hi @rupali2.deshmukh ,

Could you try Selecting the Column Names One By one in the Select Query, The Syntax is as below :

```auto
SELECT column1, column2, ...
FROM table_name;

```

Instead of \* try specifying the column names so that we can identify if the error is due to a Particular Column, we can then decide a Work around for this.

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 5, 2022, 12:55pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/11 "2022-04-05T12:55:32Z")

</div>

> [@supermanPunch](#):
>
> > [@rupali2.deshmukh](#):
> >
> > Select \* From empmaker\_ar\_head Where sys\_ar\_no =‘802004400045’

I just ran by the way you suggested but still getting the same error.  
But from SQL developer its working fine.

Select Client\_ID, N\_Name From empmaker\_ar\_head Where sys\_ar\_no =‘802004400045’

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [April 5, 2022, 1:02pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/12 "2022-04-05T13:02:14Z")

</div>

> [@rupali2.deshmukh](#):
>
> Select Client\_ID, N\_Name From empmaker\_ar\_head Where sys\_ar\_no =‘802004400045’

@rupali2.deshmukh , As it is a Simple Query, We would need to Debug further to understand the cause.

Please do Check by selecting only single Column at a Time, also without the Where clause.

Also, If you do have any other Table available, Do Check the Select Query on that and Check if it provides the Same error.

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 5, 2022, 1:14pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/13 "2022-04-05T13:14:04Z")

</div>

> [@supermanPunch](#):
>
> Please do Check by selecting only single Column at a Time, also without the Where clause.

I tried selecting only single Column at a Time, without the Where clause its not working.

Also I tried with another table having the 4 records, still I’m getting the same error.

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [April 5, 2022, 1:32pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/14 "2022-04-05T13:32:38Z")

</div>

@rupali2.deshmukh ,In that case, Could You Specify which version of Database Activities are you using ?

Most probably there is a Bug, but Could You also make sure the connection configuration is proper as well.

If possible, Do post Screenshots of your workflow to analyse the flow.

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 5, 2022, 1:53pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/15 "2022-04-05T13:53:41Z")

</div>

> [@supermanPunch](#):
>
> ut Could You also make sure the connection configuration is proper as well.

Im using the version of 1.5.0, The connection was successful with database by using connect activity.

Please see the below flow.

![image](https://global.discourse-cdn.com/uipath/original/4X/d/1/d/d1d4d585895c8b32943ff61ac3ebc109b255a67d.png)

---

<div class="post-metadata">

**Author:** ![rupali2.deshmukh](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rupali2.deshmukh/32/177294_2.png) [@rupali2.deshmukh](https://forum.uipath.com/u/rupali2.deshmukh)\
**Post date:** [April 5, 2022, 4:50pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/16 "2022-04-05T16:50:48Z")

</div>

Can anyone has any idea about how to report this issue to UiPath team?

---

<div class="post-metadata">

**Author:** ![pulapathiswathi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pulapathiswathi/32/267109_2.png) [@pulapathiswathi](https://forum.uipath.com/u/pulapathiswathi)\
**Post date:** [May 2, 2022, 3:56pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/17 "2022-05-02T15:56:04Z")

</div>

Hi Did you got solution ? I am also facing same error

---

<div class="post-metadata">

**Author:** ![alexander.orischenko](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/alexander.orischenko/32/263147_2.png) [@alexander.orischenko](https://forum.uipath.com/u/alexander.orischenko)\
**Post date:** [June 24, 2022, 7:03pm UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/18 "2022-06-24T19:03:58Z")

</div>

> [@pulapathiswathi](#):
>
> n ? I am also facing same

@sarathi125, @shreyash_shirbhate, same issue when trying to execute stored procedure with OUT parameter of type VARCHAR and specifying a string variable to that parameter in UiPath. When this parameter is not assigned inside a procedure - it doesn’t return a string to place into variable - it returns NULL.  
That NULL can not be correctly converted to String.Empty in UiPath (  
Though in any visual clients to Oracle execution of that procedure finishes clearly.

---

<div class="post-metadata">

**Author:** ![SnehajitDas](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/snehajitdas/32/544299_2.png) [@SnehajitDas](https://forum.uipath.com/u/SnehajitDas)\
**Post date:** [March 7, 2023, 10:18am UTC](https://forum.uipath.com/t/while-executing-the-db-query-getting-error/412308/19 "2023-03-07T10:18:00Z")

</div>

Hello @alexander.orischenko , were you able to resolve the issue?
