# JDBC streaming plugin, variable statement

**URL:** <https://discuss.elastic.co/t/jdbc-streaming-plugin-variable-statement/280630>\
**Category:** Logstash\
**Created:** [August 6, 2021, 9:06am UTC](https://discuss.elastic.co/t/jdbc-streaming-plugin-variable-statement/280630 "2021-08-06T09:06:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JFO\_90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jfo_90/32/83901_2.png) [@JFO\_90](https://discuss.elastic.co/u/JFO_90)\
**Post date:** [August 6, 2021, 9:06am UTC](https://discuss.elastic.co/t/jdbc-streaming-plugin-variable-statement/280630/1 "2021-08-06T09:06:18Z")

</div>

Hi,

Im using elasticsearch input plugin to obtain info from elastic, with this extracted info i use the JDBC streaming plugin to get information from BD with some fields that i extracted from elastic.  
The problem that I have is that the statement to execute changes depending on the value that i extract from Elastic.  
Is there any way to define a variable statement either through a variable that takes a value according to some condition?

For example, if I extract from elastic the variable A with value B  
the query would be

SELECT \* FROM  
TABLE Y WHERE NAME = 'B'

On the other hand, if I extract the variable B with value C, the query would be

SELECT \* FROM TABLE Z,Y WHERE CITY = 'C'

Best regards,

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 3, 2021, 9:06am UTC](https://discuss.elastic.co/t/jdbc-streaming-plugin-variable-statement/280630/2 "2021-09-03T09:06:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
