Splunk Search

Select Statements

dhargaurav
Engager

I want to run 2 select statements in one search. something like

select * from my_table;
select * from your_table;

When I use the ; it gives me an error
A database error occurred: ORA-00911: invalid character

0 Karma

ziegfried
Influencer

That's not possible. dbquery can only run a single SQL statement at a time, not a SQL-script. As an alternative you can form a union:

select * from my_table union all select * from your_table

ziegfried
Influencer

What result would you expect?

0 Karma

dhargaurav
Engager

Thanks for the quick response. the above works when I union all the same table but how about different tables.

select ship_via, ship_via_desc from ship_via where ship_via in ('F150','F750')
union all
select ship_via, count(ship_via)
from carton_hdr where carton_nbr in (SELECT rpt_parm from RPT_REQST_Q
WHERE STAT_CODE = 93 AND CREATE_DATE_TIME > SYSDATE - 1) group by ship_via

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...