如何调用需要在Matlab中指定参数的sql存储过程

时间:2022-01-06 16:37:47

Hello my first posting here: I am trying to call a sql stored procedure in Matlab, and the sql stored procedure requires me to specify start_date and end_date. I am new to Matlab, below is what I have created within the function to call sql stored procedure in Matlab:

您好我的第一个帖子在这里:我试图在Matlab中调用sql存储过程,而sql存储过程要求我指定start_date和end_date。我是Matlab的新手,下面是我在函数中创建的,在Matlab中调用sql存储过程:

SQL_TO_MATLAB= DataImport()
conn=database('ABC')
inputargs = {'start_date','end_date'}
SqlCurs=exec(conn,'sp_Get_Asset_Class_Returns',inputargs)
Matlabdata = fetch(SqlCurs)

My question is: if I would like to specify start_date as 2012/04/30, end_date as 2016/04/30, where I should indicate these two dates within this function?

我的问题是:如果我想将start_date指定为2012/04/30,将end_date指定为2016/04/30,我应该在此函数中指明这两个日期?

Thanks a lot for your kind advise!

非常感谢您的善意建议!

1 个解决方案

#1


0  

It looks like the correct function to use is runstoredprocedure.

看起来正确使用的函数是runstoredprocedure。

I'm not setup to test this right now, but I suspect the calling convention would look something like this (assuming the result of the stored procedure was a resultSet):

我现在没有设置为测试它,但我怀疑调用约定看起来像这样(假设存储过程的结果是resultSet):

SQL_TO_MATLAB= DataImport()
conn=database('ABC')
x = runstoredprocedure(conn, 'sp_Get_Asset_Class_Returns',{'2012/04/30' '2016/04/30'})
Matlabdata = fetch(x)

#1


0  

It looks like the correct function to use is runstoredprocedure.

看起来正确使用的函数是runstoredprocedure。

I'm not setup to test this right now, but I suspect the calling convention would look something like this (assuming the result of the stored procedure was a resultSet):

我现在没有设置为测试它,但我怀疑调用约定看起来像这样(假设存储过程的结果是resultSet):

SQL_TO_MATLAB= DataImport()
conn=database('ABC')
x = runstoredprocedure(conn, 'sp_Get_Asset_Class_Returns',{'2012/04/30' '2016/04/30'})
Matlabdata = fetch(x)