# Conversion problems

**URL:** <https://forum.robotframework.org/t/conversion-problems/2191>\
**Category:** Robot Framework\
**Created:** [28 July 2021 13:10 UTC](https://forum.robotframework.org/t/conversion-problems/2191 "2021-07-28T13:10:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miltin](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/miltin/32/903_2.png) [@Miltin](https://forum.robotframework.org/u/Miltin)\
**Post date:** [28 July 2021 13:10 UTC](https://forum.robotframework.org/t/conversion-problems/2191/1 "2021-07-28T13:10:28Z")

</div>

Good morning, I’m running a query to oracle database, however it returns list. So that I can make an insertion I need a variable of type integer or number, and the database returns an error: DatabaseError: ORA-01722: invalid number, because the type of variable is list. Below is the query:

${idUsername} = Query Select ID from sbr\_collaborator where login like ${username}

How can i convert so that my database recognizes the variable?

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [28 July 2021 13:58 UTC](https://forum.robotframework.org/t/conversion-problems/2191/2 "2021-07-28T13:58:06Z")

</div>

Yes, the Query returns a list, so you need to use the index of the element you need:  
`${idUsername[0]}`

Or use other convertion keyword, (maybe from BuiltIn, Collections or String).

This should also work:  
` ${queried_name}= Set Variable ${idUsername[0]}`

---

<div class="post-metadata">

**Author:** ![Miltin](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/miltin/32/903_2.png) [@Miltin](https://forum.robotframework.org/u/Miltin)\
**Post date:** [28 July 2021 16:55 UTC](https://forum.robotframework.org/t/conversion-problems/2191/3 "2021-07-28T16:55:28Z")

</div>

When I use ‘set variable’, it gives a return : type tuple

Query INSERT INTO crm\_regra\_excecao (ID\_REGRA, ID\_COLABORADOR, VALOR, ID, id\_usuario) VALUES (2,‘NULL’,‘S’, ID\_CRM\_REGRA\_EXCECAO.nextval , ‘${queried\_name}’)

DatabaseError: ORA-01722: invalid number

---

<div class="post-metadata">

**Author:** ![Miltin](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/miltin/32/903_2.png) [@Miltin](https://forum.robotframework.org/u/Miltin)\
**Post date:** [28 July 2021 17:25 UTC](https://forum.robotframework.org/t/conversion-problems/2191/4 "2021-07-28T17:25:25Z")

</div>

it worked, thank you very much!!

I USED THE SET VARIABLE AND THEN USED A FULL TUPLE CONVERSION FUNCTION:  
def converteTUPLA(vartupla):  
res = functools.reduce(lambda sub, ele: sub \* 10 + ele, vartupla)  
return res
