All Apps and Add-ons

How to call stored procedure from SPLUNK DB CONNECT ?

abhishekkalokhe
Explorer

i have following stored procedure in SYBASE database

create procedure sp__cpu_busy_thread_test
as
begin
select @@servername,@@version
end
return(0)

and i tried calling it as :-

CALL sp_cpu_busy_thread_test
EXEC sp
cpu_busy_thread_test
EXEC sp
_cpu_busy_thread_test();

after that i am getting following errors:-

SybSQLException: Execute cursur 'jconnect_implicit_1' is declared on a procedure which contains a non SELECT or a SELECT with a compute clause. for declaration of this cursor to be legal it should i have a single SELECT statement without a COMPUTE clause.
and
No results found for this query.

0 Karma

koshyk
Super Champion

in Dbconnect V3, this is supported I believe
https://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Commands#Required_Arguments
Syntax something like: dbxquery procedure="{call <procedure-name>}"

We couldn't find a simple way in Dbconnect V2, So what we have done is
1. to Create a function on top of the stored procedure
2. And use Select statement to call this function
Very similar to example shown in
https://stackoverflow.com/questions/14506871/how-to-execute-a-stored-procedure-inside-a-select-query

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...