Chapter 15 Writing SQL Statements in PowerDesigner


SQLXML

Description

Avoids typing a SQL/XML query in the definition of a trigger, a procedure or a function. Use one of the following tools:

After generation, the SQLXML macro is replaced by the SQL/XML query of the global element.

Syntax

.SQLXML(code of an XML model::code of a global element)

Note: the code of an XML model is optional.

Example

In a trigger for the table EMPLOYEE, the following macro:

.SQLXML(CorporateMembership::DEPARTMENT)

generates the following trigger script:

select XMLELEMENT( NAME "Department", XMLATTRIBUTES (DEPNUM,DEPNAME),
       (select XMLAGG ( XMLELEMENT( NAME "Employee", XMLATTRIBUTES (DEPNUM,EMPID,FIRSTNAME,LASTNAME)) )
        from EMPLOYEE 
        where DEPNUM = DEPNUM))
from DEPARTMENT


 


Copyright (C) 2005. Sybase Inc. All rights reserved.