cancel
Showing results for 
Search instead for 
Did you mean: 

OLEDB Query execution from data item

mfortunato
Level 3
Dynamically generating a query and placing it within the data item.
When trying to run the Data - OLEDB --> Get Collection and calling the data item, i get the below error message.

Could not execute code stage because exception thrown by code stage: Syntax error near '(end of line)' on line 1

But if i copy the query from the data item and place it within the Get Collection expression, it works perfectly.

------------------------------
Mario Fortunato
RPA Manager
FirstRand
Africa/Windhoek
------------------------------
3 REPLIES 3

DaveMorris
Level 14
Do you have extra quotations when it's in the data item? You may know this already, but I'll explain just in case.

If you put the Query into the SQL input of the Get Collection action, it has to have quotations around it like "SELECT * FROM tblTable", but if you put it in a data item it should not have the quotes around it but instead should be like SELECT * FROM tblTable.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Hi Dave
I have tried all possible scenarios and yes you are correct.
When i have the query directly within the Get Collection i do have quotations around. But within the data item i'm not placing quotations, calling the data item [Final SQL Section 1] and getting the below error.

Could not execute code stage because exception thrown by code stage: Syntax error near '(end of line)' on line 1

------------------------------
Mario Fortunato
RPA Manager
FirstRand
Africa/Windhoek
------------------------------

The only other thing I can think would involve character escaping. Any chance you could paste your SQL here, and I could try it as well.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA