# Database steps in a loop

**URL:** <https://community.automationedge.com/t/database-steps-in-a-loop/2824>\
**Category:** Get Help & Discuss\
**Tags:** plugin\
**Created:** [February 18, 2021, 10:19am UTC](https://community.automationedge.com/t/database-steps-in-a-loop/2824 "2021-02-18T10:19:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NipunA](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@NipunA](https://community.automationedge.com/u/NipunA)\
**Post date:** [February 18, 2021, 10:19am UTC](https://community.automationedge.com/t/database-steps-in-a-loop/2824/1 "2021-02-18T10:19:26Z")

</div>

I have a pdf form, which I’m reading to extract some data. Data is stored in variables named test1, test2, test3…test6

now I have to fetch data from my database table which matches the values of these variables  
i.e.  
first time query:  
select col1, col2 from table where col3 = test1  
second time it’ll be  
select col1, col2 from table where col3 = test2  
Third time:  
select col1, col2 from table where col3 = test3

and so on.

I was trying to use a loop, but none of the SQL script, Table input or Database lookup steps are allowed in the loop.

how can i achieve the desired function ?

---

<div class="post-metadata">

**Author:** ![pratik](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pratik](https://community.automationedge.com/u/pratik)\
**Post date:** [February 19, 2021, 10:01am UTC](https://community.automationedge.com/t/database-steps-in-a-loop/2824/2 "2021-02-19T10:01:05Z")

</div>

Hello Nipun,

Attaching this workflow for your reference. Please check if it helps you solve the problem.

[Workflow.zip](https://community.automationedge.com/uploads/short-url/32CD2zYl4kDUsv9DqvnHKDqMzUy.zip) (5.2 KB)
