op:from-sql

op:from-sql(
   $select as xs:string,
   [$qualifier as xs:string?]
) as map:map

Summary

This function dynamically constructs a row set based on a SQL SELECT query from views.

Parameters
$select A SQL SELECT query expressed as a string.
$qualifier Specifies a name for qualifying the column names. Placeholder parameters in the SQL string may be bound in the result() call

Example

(: List all of the employees in the 'employees' view. :)

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

  op:from-sql('SELECT employees.FirstName, employees.LastName FROM employees')
     => op:result()
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy