Michael Angeleri · Feb 24

Parameter in embedded SQL

Hello, first question for me:

Is there a way to use a class Parameter in embedded SQL without having to declare a local variable, in a similar way to how it is done with Property by preponing i% as described here. See my example:

Class Test.Test Extends %RegisteredObject
Parameter MyParam = "1";  
Property MyProperty;  
Method PerformQuery() {
    set myParamLocalVar = ..#MyParam //this is what I would like to avoid
        WHERE MY_PROPERTY = :i%MyProperty
        AND MY_PARAM = :myParamLocalVar)
Product version: IRIS 2020.1
0 122
Discussion (1)1
Log in or sign up to continue

No it is not possible.
this would require having the complete instantiated object inside your query.
If you require such functionality you should use a dynamic query
where you pass the i%* as a query parameter out of your actual running context.