拼接动态sql语句可参考元编程教程(
https://gitee.com/dolphindb/T... ) , 上面例子可试试下面代码:
sym='ICL8' dbName="dfs://future_0523" n=50:100 sql(select=sqlCol("*"),from=loadTable(dbName,"CustomInstruments"),where=[<date=today()>,<CustomInstID=sym>],limit=n).eval()
在DolphinDB database GUI中,我要定义函数动态的拼接多行脚本来执行,请问有什么方法吗?
比如,如下图所示这种多行脚本,箭头的地方是变量,需要动态替换的:
里面还有limit需要设置为变量,但如下所示我直接在select语句后面加limit变量:
n=100 select * from customInstruments limit n
执行这个语句会报错: constant integer expected after keyword limit。
拼接动态sql语句可参考元编程教程(
https://gitee.com/dolphindb/T... ) , 上面例子可试试下面代码:
sym='ICL8' dbName="dfs://future_0523" n=50:100 sql(select=sqlCol("*"),from=loadTable(dbName,"CustomInstruments"),where=[<date=today()>,<CustomInstID=sym>],limit=n).eval()