Question
· Nov 1, 2021

SQL Method to use in a Mumps routine

Hi there,

Does anyone have an example of the method used to run an SQL query and generate the view in a Mumps routine.   I have several SQL queries created from a vendor that need to be converted and the corresponding view referenced.  I cannot seem to find any examples in IDX routines or in the  IRIS/Cache documentation.  Any help is appreciated.

-Alicia

Product version: IRIS 2021.1
Discussion (5)0
Log in or sign up to continue
callSQL ;
 ; compose an SQL Statement
 set query="SELECT something FROM TABLE_A JOIN TABLE_B ON ...........WHERE ...."  
 set rs=##class/%ResultSet.%NEW()
 set sc=rs.Prepare(query)
 if 'sc write $system.OBJ.DisplayError(sc)
 set sc=rs.Execute()
 if 'sc write $system.OBJ.DisplayError(sc)
 while rs.%Next() {
    ;consume the result set  row by row
}

OK yo can write this in .INT, in .MAC, in Methods .....

and SORRY:
IDX is still just 3 chars to me, as Athena is 6 chars. (or the Greek Godess of Wisdom)

The SQL statement you pass is an ordinary string.
So with LongString enable it is about 3,4MB  and of course I have never tried to write so
much in a single string. That's boring and hard to type.
If you mean running long it's probably just useful on the command line or background.
an ordinary connection to over ODBC/JDBC or HTTP in browser will most likely time out. 
What type of LONG are you referring to ?