Accesing query results in robot framework

I am using databaselibrary to fetch multiple rows of data (on column each) to use for further testing. I need to be able to fetch the individual values for further use. Currently I am trying:

    ${Cardnumbers}=      query   SELECT card_num from xxxxxxxxx WHERE status = 
    'Issued' and ACTIVE_Flg = 'Y' and ROWNUM < 100
    Set Test Variable    ${Cardnumbers}
    ${Cardnumber} =  set test variable  ${Cardnumbers[0][1]}
    log   ${Cardnumber}

What am I doing wrong? I think this is how I proceeded on earlier cases, but now it is failig (saying that it can't find ${Cardnumbers[0][1]). The output of the query is:

   ${Cardnumbers} = [('2661999743484',), ('2661999743491',), ('2661999743507',), 
   ('2661999743514',), ('2661999743521',), ('2661999743538',), ('2661999743545',), 
   ('2661999743552',), ('2661999743569',), ('2661999743576',),...

You are addressing a missing element from the tuple. Try like this:

${Cardnumber} =  set test variable  ${Cardnumbers[0]}[0]

Your query will return a single column - SELECT card_num from , but you are trying to access a 2nd in the result. Remember that the response - when it is already a python object - is a list of tuples: when accessing it, the first index will be the "row" in the response, the second - the "column".

So by typing ${Cardnumbers[0][1]} you're effectively saying "Get me the value from the 1st row, and the 2nd column". Change it to ${Cardnumbers[0][0]} (or [4][0]for the 5th row and so on, as long as the second index is 0) and it will work.