Create a local copy of a linked table
As foreign tables are behind a paywall (booo); we have a external cache system using the intersystems ODBC driver or usually a .jar CacheDB.jar.
The requirement is :
"Create a copy of the external table once a day to perform comparisons to detect changes"
We could go full code and this is what we will do but trying the following should ideally work
CREATETABLE Sample.YoungPeopletwo ASSELECT *
FROM Pennine_TIE_Clinicom_Link.PMISPECIALREGNCA
WITH STORAGETYPE = COLUMNARThis resulted in
[SQLCODE: <-400>:<Fatal error occurred>]
[%msg: <Exception caught during dSQL statement %Execute: <UNDEFINED> SQLCODE>]if we created a table and tested inserting the values '1','2','3' and it worked
But if we tried at once with a single statment with a select into (1 value) it fails
INSERTINTO Sample.YoungPeople (PASReligionCode) values (SELECT internalPatientNumber FROM Pennine_TIE_Clinicom_Link.PMISPECIALREGNCA where InternalPatientNumber=100)with 1 or all 3 fields popluated we get
SQLCODE: -12
Message: A term expected, beginning with either of: identifier, constant, aggregate, $$, (, :, +, -, %ALPHAUP, %EXACT, %MVR%SQLSTRING, %SQLUPPER, %STRING, %TRUNCATE, or %UPPER^ INSERT INTO Sample . YoungPeople ( PASReligionCode ) VALUES ( SELECTIt is frustrating linking a cache db doens't seem to work right out of the box and the fact linked tables which seems a linked tables but actually work is behind a paid feature.
Any ideas of anything to work around the issues other than the plan to go to (complete dummy code i know none is syntax correct)
TStart//Get resultset set rs=....
While rs.%Next{
set sc-&sql (insert into copy table () values rs.1,rs.2...)
if sc not ok TRollback.... quit
}
if sc is ok TCommitComments
It would be good to understand what versions you are talking about. You marked this s IRIS2024.1 but you are talking about Cache odbc drivers. Also it would be good to know which licenses you are using as you are talking of a paywall... Usually IRIS is not limited if you are using a full license. Only limitations in using community are resources, connections and access to some enterprise level protocols (like ECP, Sharding, API Manager).
Think linked table is external software running a cache db backend. It is IRIS for Health 2024 that is used as the TIE.
The Foreign Table functionality is not free, it need to be part of the IRIS licence to allow you to use it, as i requested it and was told it would need added onto the licence to enable this feature.
Very strange syntax:
But if we tried at once with a single statment with a select into (1 value) it failsSee:<FONT COLOR="#0000ff">INSERT </FONT><FONT COLOR="#000080">INTO </FONT><FONT COLOR="#008000">Sample</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">YoungPeople </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008000">PASReligionCode</FONT><FONT COLOR="#000000">) </FONT><FONT COLOR="#000080">values </FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#0000ff">SELECT </FONT><FONT COLOR="#008000">internalPatientNumber </FONT><FONT COLOR="#000080">FROM </FONT><FONT COLOR="#008000">Pennine_TIE_Clinicom_Link</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#008000">PMISPECIALREGNCA </FONT><FONT COLOR="#000080">where </FONT><FONT COLOR="#008000">InternalPatientNumber</FONT><FONT COLOR="#000000">=100)</FONT>
Thanks i had looked at the documentation the insert data from another table and the defining a table from another table.
Yes the syntax wasn't quite like documentation (was solid normal sql syntax i think) . Still doesn't seem to like it via linked table
.png)
.png)
ERROR #5475: Error compiling routine: %sqlcq.SRFT.cls301. Errors: %sqlcq.SRFT.cls301.cls ERROR: %sqlcq.SRFT.cls301.1(19) : <UNDEFINED>parseExtFromNode+1^%qaqcmx *mt("f","1^SAMPLE.TEST") :
.png)