Selecting fields from a sql stored procedure
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to figure out how to translate a sql query such as the following using the database toolbox. Assistance much appreciated!
Select PositionDate, Quantity, StrategyDescription
From MYStoredProc('DEF', '1', default)
where StrategyDescription not in ('Event')
Thanks Thomas
0 Kommentare
Antworten (1)
Piyush Kumar
am 29 Okt. 2024 um 11:15
Hi,
I couldn't find a way to write a SQL query that directly achieves the desired filtering.
However, If you want to call a stored procedure and filter its output using a MATLAB script, you can use fetch function to execute the sql query and filter its output using MATLAB.
% Define the SQL query to call the stored procedure
query = "CALL MYStoredProc('DEF', '1', DEFAULT)";
% Execute the query and fetch the results
data = fetch(conn, query);
% Filter the results in MATLAB
Also, I have found a stack overflow question that highlights this as the limitations of stored procedures in SQL and suggests to use user defined functions in these scenarios.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!