<?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 Splunk DB Connect Tail Command Alias Problem in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61788#M70430</link>
    <description>&lt;P&gt;I'm trying to setup a tail input with a query that uses some column aliases. I use one of these column aliases as my rising column. I'm getting confused because on the initial run, I get results, but then with each subsequent execution I get an invalid identifier error. &lt;/P&gt;

&lt;P&gt;Can you use a column alias as a rising column and if so does it need to be in all caps (for oracle) or as defined in the sql? When it gives me the error it has the column in all caps, but I've tried it both ways and it doesn't seem to work. &lt;/P&gt;

&lt;P&gt;Here are the details of the error&lt;BR /&gt;
2013-06-12 12:13:37.365 dbx7003:ERROR:TailDatabaseMonitor - Error while executing database monitor: java.sql.SQLSyntaxErrorException: ORA-00904: "WAVE_NUMBER": invalid identifier&lt;BR /&gt;
java.sql.SQLSyntaxErrorException: ORA-00904: "WAVE_NUMBER": invalid identifier&lt;BR /&gt;
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)&lt;BR /&gt;
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)&lt;BR /&gt;
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)&lt;BR /&gt;
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)&lt;/P&gt;

&lt;P&gt;Once again my alias is "Wave_Number" and I have done both Wave_Number and WAVE_NUMBER and both seem to only work upon initial execution and fail upon subsequent runs.&lt;/P&gt;

&lt;P&gt;I have since changed the initial SQL, but it is extremely similar to the below&lt;BR /&gt;
with &lt;BR /&gt;
loginfo as&lt;BR /&gt;
(&lt;BR /&gt;
select wp.whse, ref_value_1 as wave_nbr, wp.wave_desc as wave_desc,&lt;BR /&gt;
wp.max_units as max_units, wp.max_orders as max_pkts,&lt;BR /&gt;
log_date_time as wave_start_time,&lt;BR /&gt;
(select log_date_time from wmos_efc.msg_log where module = 'WAVE' and msg_id = '2018' and ref_value_1 = ml.ref_value_1) as wave_end_time,&lt;BR /&gt;
wp.wave_stat_code&lt;BR /&gt;
from wmos_efc.msg_log ml, wmos_efc.wave_parm wp&lt;BR /&gt;
where ml.ref_value_1 = wp.wave_nbr&lt;BR /&gt;
and module = 'WAVE'&lt;BR /&gt;
and msg_id = '2003'&lt;BR /&gt;
and wp.create_date_time &amp;gt; SYSDATE - 1&lt;BR /&gt;
),&lt;BR /&gt;
pktinfo as&lt;BR /&gt;
(&lt;BR /&gt;
select o.rte_wave_nbr, count(tc_order_id) as total_pkts, sum(o.tax_id) as total_units&lt;BR /&gt;
from wmos_efc.orders o, wmos_efc.wave_parm wp&lt;BR /&gt;
where o.rte_wave_nbr = wp.wave_nbr&lt;BR /&gt;
and wp.create_date_time &amp;gt; SYSDATE - 1&lt;BR /&gt;
group by o.rte_wave_nbr&lt;BR /&gt;
),&lt;BR /&gt;
waveinfo as&lt;BR /&gt;
(&lt;BR /&gt;
select /*+ OPT_PARAM('_optimizer_cost_based_transformation' 'linear') */&lt;BR /&gt;
loginfo.whse, loginfo.wave_nbr, loginfo.wave_desc, loginfo.max_pkts, loginfo.max_units,&lt;BR /&gt;
loginfo.wave_start_time, loginfo.wave_end_time, pktinfo.total_pkts,&lt;BR /&gt;
pktinfo.total_units, to_char(trunc(sysdate) + (loginfo.wave_end_time-loginfo.wave_start_time), 'HH24":"MI":"SS') as total_wave_time &lt;BR /&gt;
from loginfo, pktinfo&lt;BR /&gt;
where loginfo.wave_nbr = pktinfo.rte_wave_nbr&lt;BR /&gt;
and loginfo.wave_end_time &amp;gt;= SYSDATE - 60/1440&lt;BR /&gt;
order by loginfo.wave_start_time&lt;BR /&gt;
)&lt;BR /&gt;
select whse AS Warehouse, TO_CHAR(wave_start_time, 'YYYY-MM-DD HH24:MI:SS') AS Start Time, wave_nbr AS Wave Number, wave_desc AS Wave Description, max_pkts AS Max Pkts, max_units AS Max Units, TO_CHAR(wave_end_time, 'YYYY-MM-DD HH24:MI:SS') AS End Time, total_pkts AS Total Pkts, &lt;BR /&gt;
total_units AS Total Units, total_wave_time AS Total Wave Time &lt;BR /&gt;
from waveinfo&lt;BR /&gt;
{{where $rising_column$ &amp;gt; ?}}&lt;/P&gt;

&lt;P&gt;Rising Column = Wave Number&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:04:38 GMT</pubDate>
    <dc:creator>Sammich</dc:creator>
    <dc:date>2020-09-28T14:04:38Z</dc:date>
    <item>
      <title>Splunk DB Connect Tail Command Alias Problem</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61788#M70430</link>
      <description>&lt;P&gt;I'm trying to setup a tail input with a query that uses some column aliases. I use one of these column aliases as my rising column. I'm getting confused because on the initial run, I get results, but then with each subsequent execution I get an invalid identifier error. &lt;/P&gt;

&lt;P&gt;Can you use a column alias as a rising column and if so does it need to be in all caps (for oracle) or as defined in the sql? When it gives me the error it has the column in all caps, but I've tried it both ways and it doesn't seem to work. &lt;/P&gt;

&lt;P&gt;Here are the details of the error&lt;BR /&gt;
2013-06-12 12:13:37.365 dbx7003:ERROR:TailDatabaseMonitor - Error while executing database monitor: java.sql.SQLSyntaxErrorException: ORA-00904: "WAVE_NUMBER": invalid identifier&lt;BR /&gt;
java.sql.SQLSyntaxErrorException: ORA-00904: "WAVE_NUMBER": invalid identifier&lt;BR /&gt;
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)&lt;BR /&gt;
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)&lt;BR /&gt;
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)&lt;BR /&gt;
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)&lt;BR /&gt;
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)&lt;/P&gt;

&lt;P&gt;Once again my alias is "Wave_Number" and I have done both Wave_Number and WAVE_NUMBER and both seem to only work upon initial execution and fail upon subsequent runs.&lt;/P&gt;

&lt;P&gt;I have since changed the initial SQL, but it is extremely similar to the below&lt;BR /&gt;
with &lt;BR /&gt;
loginfo as&lt;BR /&gt;
(&lt;BR /&gt;
select wp.whse, ref_value_1 as wave_nbr, wp.wave_desc as wave_desc,&lt;BR /&gt;
wp.max_units as max_units, wp.max_orders as max_pkts,&lt;BR /&gt;
log_date_time as wave_start_time,&lt;BR /&gt;
(select log_date_time from wmos_efc.msg_log where module = 'WAVE' and msg_id = '2018' and ref_value_1 = ml.ref_value_1) as wave_end_time,&lt;BR /&gt;
wp.wave_stat_code&lt;BR /&gt;
from wmos_efc.msg_log ml, wmos_efc.wave_parm wp&lt;BR /&gt;
where ml.ref_value_1 = wp.wave_nbr&lt;BR /&gt;
and module = 'WAVE'&lt;BR /&gt;
and msg_id = '2003'&lt;BR /&gt;
and wp.create_date_time &amp;gt; SYSDATE - 1&lt;BR /&gt;
),&lt;BR /&gt;
pktinfo as&lt;BR /&gt;
(&lt;BR /&gt;
select o.rte_wave_nbr, count(tc_order_id) as total_pkts, sum(o.tax_id) as total_units&lt;BR /&gt;
from wmos_efc.orders o, wmos_efc.wave_parm wp&lt;BR /&gt;
where o.rte_wave_nbr = wp.wave_nbr&lt;BR /&gt;
and wp.create_date_time &amp;gt; SYSDATE - 1&lt;BR /&gt;
group by o.rte_wave_nbr&lt;BR /&gt;
),&lt;BR /&gt;
waveinfo as&lt;BR /&gt;
(&lt;BR /&gt;
select /*+ OPT_PARAM('_optimizer_cost_based_transformation' 'linear') */&lt;BR /&gt;
loginfo.whse, loginfo.wave_nbr, loginfo.wave_desc, loginfo.max_pkts, loginfo.max_units,&lt;BR /&gt;
loginfo.wave_start_time, loginfo.wave_end_time, pktinfo.total_pkts,&lt;BR /&gt;
pktinfo.total_units, to_char(trunc(sysdate) + (loginfo.wave_end_time-loginfo.wave_start_time), 'HH24":"MI":"SS') as total_wave_time &lt;BR /&gt;
from loginfo, pktinfo&lt;BR /&gt;
where loginfo.wave_nbr = pktinfo.rte_wave_nbr&lt;BR /&gt;
and loginfo.wave_end_time &amp;gt;= SYSDATE - 60/1440&lt;BR /&gt;
order by loginfo.wave_start_time&lt;BR /&gt;
)&lt;BR /&gt;
select whse AS Warehouse, TO_CHAR(wave_start_time, 'YYYY-MM-DD HH24:MI:SS') AS Start Time, wave_nbr AS Wave Number, wave_desc AS Wave Description, max_pkts AS Max Pkts, max_units AS Max Units, TO_CHAR(wave_end_time, 'YYYY-MM-DD HH24:MI:SS') AS End Time, total_pkts AS Total Pkts, &lt;BR /&gt;
total_units AS Total Units, total_wave_time AS Total Wave Time &lt;BR /&gt;
from waveinfo&lt;BR /&gt;
{{where $rising_column$ &amp;gt; ?}}&lt;/P&gt;

&lt;P&gt;Rising Column = Wave Number&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:04:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61788#M70430</guid>
      <dc:creator>Sammich</dc:creator>
      <dc:date>2020-09-28T14:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Tail Command Alias Problem</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61789#M70431</link>
      <description>&lt;P&gt;Could you please add the detailed error message to the question?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2013 19:56:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61789#M70431</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-06-12T19:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Tail Command Alias Problem</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61790#M70432</link>
      <description>&lt;P&gt;Are you using custom SQL or did you just specify a table?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2013 20:26:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61790#M70432</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-06-12T20:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Tail Command Alias Problem</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61791#M70433</link>
      <description>&lt;P&gt;For the initial run (when there is no checkpoint value) of the database input, the part in the double-curly brackets is omitted (ie. &lt;CODE&gt;{{...}}&lt;/CODE&gt;). For any subsequent run (when there is a checkpoint value), the part is included (without the curly brackets them-selfes) and the rising column placeholder is replaced. In your example it would result in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... where Wave_Number &amp;gt; ?
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your case you can't use the column alias &lt;CODE&gt;Wave_Number&lt;/CODE&gt; in the WHERE clause (the WHERE clause is actually evaluated before the SELECT clause). &lt;/P&gt;

&lt;P&gt;You could probably wrap you whole SQL statement in another, outer SELECT statement like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM (
    &amp;lt;your SQL&amp;gt;
) as inner_table
{{WHERE $rising_column$ &amp;gt; ?}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using a HAVING-clause instead of WHERE would probably work as well:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your SQL&amp;gt;
{{HAVING $rising_column$ &amp;gt; ?}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Otherwise I'd suggest not to use a column alias.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2013 23:11:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-DB-Connect-Tail-Command-Alias-Problem/m-p/61791#M70433</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-06-12T23:11:34Z</dc:date>
    </item>
  </channel>
</rss>

