<?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 Re: Need to get data from a stored procedure in DB using the data connect app in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194893#M98636</link>
    <description>&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/123239/can-db-connect-run-stored-procedures.html"&gt;http://answers.splunk.com/answers/123239/can-db-connect-run-stored-procedures.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jun 2015 02:59:55 GMT</pubDate>
    <dc:creator>SrinivasaC</dc:creator>
    <dc:date>2015-06-04T02:59:55Z</dc:date>
    <item>
      <title>Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194888#M98631</link>
      <description>&lt;P&gt;I tried various ways to execute a stored procedure using the DB connect app in splunk. But i am not able to do so. The DB connect app is designed to execute sql queries to get the data but it doesnt seem to have a provision for a stored procedure. Can someone pls suggest a way to do it.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 12:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194888#M98631</guid>
      <dc:creator>saipavan</dc:creator>
      <dc:date>2014-01-03T12:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194889#M98632</link>
      <description>&lt;P&gt;Could you please add some more details, such as an example of what you've been trying to execute, error messages, details about the database, especially the database type/version.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2014 13:00:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194889#M98632</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2014-01-03T13:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194890#M98633</link>
      <description>&lt;P&gt;Hi, since i wasnt aware if this was such a possibility i tried in whatever way i could. First i created a new dbmon-tail, provided all the details such as the database name, table name and rising column field. &lt;/P&gt;

&lt;P&gt;Next in the SQL query section i gave a PL/SQL statement like &lt;/P&gt;

&lt;P&gt;DECLARE&lt;BR /&gt;
  IN_VALUE NUMBER;&lt;BR /&gt;
  OUT_VALUE VARCHAR2(200);&lt;BR /&gt;
BEGIN&lt;BR /&gt;
  IN_VALUE := $id$;&lt;/P&gt;

&lt;P&gt;SAMPLE_AUDIT(&lt;BR /&gt;
    IN_VALUE =&amp;gt; IN_VALUE,&lt;BR /&gt;
    OUT_VALUE =&amp;gt; OUT_VALUE&lt;BR /&gt;
  );&lt;BR /&gt;
END;&lt;/P&gt;

&lt;P&gt;Here SAMPLE_AUDIT is the procedure name.&lt;/P&gt;

&lt;P&gt;This did not throw any error at all. Nor did it fetch any data.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:34:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194890#M98633</guid>
      <dc:creator>saipavan</dc:creator>
      <dc:date>2020-09-28T15:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194891#M98634</link>
      <description>&lt;P&gt;DBX 1.x does not support stored procedures.  We are investigating the possibility of supporting them in a future release of the app.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 17:05:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194891#M98634</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2014-01-06T17:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194892#M98635</link>
      <description>&lt;P&gt;hi&lt;/P&gt;

&lt;P&gt;use this for executing stored procedures &lt;/P&gt;

&lt;P&gt;search ----  | dbquery master limit=1000 "EXEC sp_readerrorlog 0,1"&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2014 06:07:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194892#M98635</guid>
      <dc:creator>phemanth</dc:creator>
      <dc:date>2014-09-16T06:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194893#M98636</link>
      <description>&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/123239/can-db-connect-run-stored-procedures.html"&gt;http://answers.splunk.com/answers/123239/can-db-connect-run-stored-procedures.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 02:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194893#M98636</guid>
      <dc:creator>SrinivasaC</dc:creator>
      <dc:date>2015-06-04T02:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194894#M98637</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;DB Connect v1 and v2 don't currently support querying stored procedures natively, but there is a work around. Hat tip to Tyler Muth for the code.&lt;/P&gt;

&lt;P&gt;In short, you can call PL/SQL packages from a query using DBX 2 as long as you wrap a table function around them. There is no way to call a PL/SQL package, procedure or function directly as DBX 2 only lets you run queries. However, a table function allows you to treat a PL/SQL array of PL/SQL objects as a table row source. &lt;/P&gt;

&lt;P&gt;This has been tested this using the latest build of dbx 2 with a db input and as a search using dbxquery. &lt;/P&gt;

&lt;P&gt;Using  example code on &lt;A href="https://oracle-base.com/articles/misc/pipelined-table-functions"&gt;https://oracle-base.com/articles/misc/pipelined-table-functions&lt;/A&gt; to test because Tim’s examples are always accurate and usually concise. &lt;/P&gt;

&lt;P&gt;Pasting the code so comments can be added:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-- this type encapsulates the columns of a row
CREATE TYPE t_tf_row AS OBJECT (
  id           NUMBER,
  description  VARCHAR2(50)
);
/

-- this is essentially an array of the type above
CREATE TYPE t_tf_tab IS TABLE OF t_tf_row;
/

-- the table function returns table type above instead of returning a scalar of type number or character
-- p_rows is an input parameter. You could have many and use these to pass onto the real PL/SQL you want to call
CREATE OR REPLACE FUNCTION get_tab_tf (p_rows IN NUMBER) RETURN t_tf_tab AS
  l_tab  t_tf_tab := t_tf_tab();
BEGIN
  FOR i IN 1 .. p_rows LOOP
    l_tab.extend;
    l_tab(l_tab.last) := t_tf_row(i, 'Description for ' || i);
  END LOOP;

  -- you could call any PL/SQL package, procedure or function you want here. If that code returns values, you could return them below as l_tab object

  RETURN l_tab;
END;
/

-- this is the query that I can run as a db input or using dbxquery. The “10” is the input parameter to the function. 
SELECT *
FROM   TABLE(get_tab_tf(10))
ORDER BY id DESC;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Mar 2016 02:21:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194894#M98637</guid>
      <dc:creator>davidpaper</dc:creator>
      <dc:date>2016-03-28T02:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need to get data from a stored procedure in DB using the data connect app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194895#M98638</link>
      <description>&lt;P&gt;Is this ran directly into the application Query? I tested it and it returned 0 rows, are you running this as one large Query? Or are you saving a job then in a separate search calling it?? &lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 16:58:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-to-get-data-from-a-stored-procedure-in-DB-using-the-data/m-p/194895#M98638</guid>
      <dc:creator>RogueMrSmith</dc:creator>
      <dc:date>2016-03-28T16:58:10Z</dc:date>
    </item>
  </channel>
</rss>

