To fetch a scalar value, there are two choises:

  • xdtl:fetch
  • xdtl:query
Obverve:
 

Using fetch

<xdtl:fetch 
      source="SELECT object_type_nm, object_type_ds FROM MD_OBJECT_TYPE WHERE object_type_cd = 0"  
      rowset="my_variable" 
      connection="$conn" />
<xdtl:log 
      msg="Name of this object type is ${my_variable.get(0)[0]}" /> 

Using query

<xdtl:query 
      source="SELECT object_type_nm, object_type_ds FROM MD_OBJECT_TYPE WHERE object_type_cd = 0" 
      target="my_variable" 
      connection="$conn" />
<xdtl:log 
      msg="Name of this object type is $my_variable" />

 

xdtl:query saves value of the first column in the first row to target variable. UPDATE and DELETE queries save the number of affected rows into the same variable.