It's been almost 9 years @Eduard Lebedyuk :-) Have ever figured out how to call a linked procedure when running a select for data from a linked table?
When I execute a select statement with only the call to the linked stored procedure, all works ok:
select CRMBI.getPlanningRate(11,2023)
Expression_1 |
---|
0.94 |
1 row(s) affected
But if I try to make that same call within a query to another table in that same package, I get errors:
select ISCurrencyID, CRMBI.getPlanningRate(ISCurrencyID,2024) from CRMBI.CurrencyRate
[SQLCODE: <-223>:<Gateway query Prepare() failed>] [%msg: <Connection 'CRMBILINKTABLES': Prepare(select T1.ISCurrencyID AS C1,(T1.ISCurrencyID...): SQLState: (42000) NativeError: [1] Message: [Iris ODBC][State : 42000][Native Code 1] [c:\intersystems\iris2021v1\bin\irisdb.exe] [SQLCODE: <-1>:<Invalid SQL statement>] [Location: <Prepare>] [%msg: < ) expected, , found ^SELECT T1 . ISCurrencyID AS C1 , ( T1 . ISCurrencyID ,>] >]
Other queries to the linked table, without the stored procedure, also works just fine:
select ISCurrencyID, USDRate, effectiveDate from CRMBI.CurrencyRate where ISCurrencyID = 11 and effectiveDate > '2022-12-31' and effectiveDate < '2023-01-31'
ISCurrencyID | USDRate | effectiveDate |
---|---|---|
11 | 0.9392000 | 2023-01-01 |
1 row(s) affected
Might be user error or a later message to the WRC, but thanks in advance if you have any ideas.
Thank you Dmitry; I confirmed it works when the dynamic arrays are stored in variables:
%SYS>w $zv IRIS for Windows (x86-64) 2024.1.1 (Build 347U) Thu Jul 18 2024 17:35:51 EDT %SYS>set arr1 = [1,2,3] %SYS>set arr2 = [6,5,4] %SYS>zw arr1.addAll(arr2) [1,2,3,6,5,4] ; <DYNAMIC ARRAY> %SYS>do arr1.addAll(arr2) %SYS>zw arr1 arr1=[1,2,3,6,5,4,6,5,4] ; <DYNAMIC ARRAY>








Try concatenating the new item as follows:
set mylist = "" for i = 1:1:5 { set item = "item"_i set mylist = mylist_$ListBuild(item) }
The output is:
zw mylist mylist=$lb("item1","item2","item3","item4","item5")