<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Is it possible to query a temp table using Splunk DB Connect? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164630#M186048</link>
    <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I am trying to use Splunk to monitor  my process by using the db connect. My problem is I am using the following query: &lt;BR /&gt;
Select * &lt;BR /&gt;
from My_table &lt;BR /&gt;
where   proc &amp;gt;= today-2 &lt;BR /&gt;
    and user_id= '  '&lt;BR /&gt;&lt;BR /&gt;
into temp My_temp_table with no log;&lt;/P&gt;

&lt;P&gt;which has a temp table to insert records into. Is it possible to query this? whenever I query this it gives me this error &lt;BR /&gt;
"command="dbquery", A database error occurred: Method only for queries" or this if I run the whole query &lt;BR /&gt;
"command="dbquery", A database error occurred: The specified table (My_temp_table) is not in the database." &lt;/P&gt;

&lt;P&gt;Also, at the end of the query, I am dropping the temp table &lt;/P&gt;

&lt;P&gt;Note: I am running this against informix database&lt;/P&gt;

&lt;P&gt;Any help is appreciated &lt;BR /&gt;
Thanks &lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 17:53:28 GMT</pubDate>
    <dc:creator>hxa27</dc:creator>
    <dc:date>2020-09-28T17:53:28Z</dc:date>
    <item>
      <title>Is it possible to query a temp table using Splunk DB Connect?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164630#M186048</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I am trying to use Splunk to monitor  my process by using the db connect. My problem is I am using the following query: &lt;BR /&gt;
Select * &lt;BR /&gt;
from My_table &lt;BR /&gt;
where   proc &amp;gt;= today-2 &lt;BR /&gt;
    and user_id= '  '&lt;BR /&gt;&lt;BR /&gt;
into temp My_temp_table with no log;&lt;/P&gt;

&lt;P&gt;which has a temp table to insert records into. Is it possible to query this? whenever I query this it gives me this error &lt;BR /&gt;
"command="dbquery", A database error occurred: Method only for queries" or this if I run the whole query &lt;BR /&gt;
"command="dbquery", A database error occurred: The specified table (My_temp_table) is not in the database." &lt;/P&gt;

&lt;P&gt;Also, at the end of the query, I am dropping the temp table &lt;/P&gt;

&lt;P&gt;Note: I am running this against informix database&lt;/P&gt;

&lt;P&gt;Any help is appreciated &lt;BR /&gt;
Thanks &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:53:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164630#M186048</guid>
      <dc:creator>hxa27</dc:creator>
      <dc:date>2020-09-28T17:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to query a temp table using Splunk DB Connect?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164631#M186049</link>
      <description>&lt;P&gt;I'm not as experienced with Informix (it's been a few years), but in general DB Connect cannot perform DDL types of operations (that would create/drop objects). Basic SELECT statements are the norm; if the database connection is not defined as read-only, you may also be able to perform DML (insert/update/delete) operations. &lt;/P&gt;

&lt;P&gt;Also, just an observation but in general I have not had much luck with Splunk indexing  queries that aren't fully qualified. It is generally considered bad programming practice to use "select *"; it is preferred to select only the columns you need, by name. With Splunk it is often necessary to detail timestamp columns and rising value columns by name in the input definition, regardless.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2014 21:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164631#M186049</guid>
      <dc:creator>pmdba</dc:creator>
      <dc:date>2014-10-15T21:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to query a temp table using Splunk DB Connect?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164632#M186050</link>
      <description>&lt;P&gt;Thanks for the comment that helps somehow. Do you know if there is a way I can run multiple queries at the same time in db connect ?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2014 22:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164632#M186050</guid>
      <dc:creator>hxa27</dc:creator>
      <dc:date>2014-10-15T22:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to query a temp table using Splunk DB Connect?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164633#M186051</link>
      <description>&lt;P&gt;Hi, if you set up dbmon input stanzas you can schedule as you need.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2014 22:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164633#M186051</guid>
      <dc:creator>jcoates_splunk</dc:creator>
      <dc:date>2014-10-15T22:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to query a temp table using Splunk DB Connect?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164634#M186052</link>
      <description>&lt;P&gt;I believe each query must be scheduled and run as a separate input. There is no way to post multiple queries as part of the same input.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164634#M186052</guid>
      <dc:creator>pmdba</dc:creator>
      <dc:date>2014-10-16T15:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to query a temp table using Splunk DB Connect?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164635#M186053</link>
      <description>&lt;P&gt;So, what would be a better option to run multiple queries ?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 14:27:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164635#M186053</guid>
      <dc:creator>hxa27</dc:creator>
      <dc:date>2014-10-17T14:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to query a temp table using Splunk DB Connect?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164636#M186054</link>
      <description>&lt;P&gt;Each query provides a unique set of data, presumably with different fields/columns, so I'm not sure you want to combine multiple queries into a single input. Defining multiple inputs allows you flexibility in scheduling and in determining other parameters like source type and field names. &lt;/P&gt;

&lt;P&gt;If you really need to combine output from multiple queries that would have common field names, etc., you could use a UNION type of construct to combine their data sets into a single set for return to Splunk. I'm not sure what the exact Informix syntax would be, but perhaps something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;select column_1, column_2 from table_1 where column_1 = x
union
select column_1, column_2 from table_2 where column_2 = y
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;with query_1 as 
(select column_1, column_2 from table_1 where column_1 = x
union
select column_1, column_2 from table_2 where column_2 = y) 
select column_1, column_2 from query_1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or perhaps combine the queries into a view in the database and select from the view in your input.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:21:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-query-a-temp-table-using-Splunk-DB-Connect/m-p/164636#M186054</guid>
      <dc:creator>pmdba</dc:creator>
      <dc:date>2014-10-17T15:21:35Z</dc:date>
    </item>
  </channel>
</rss>

