XSR_REGISTER

The XSR_REGISTER procedure is the first stored procedure to be called as part of the XML schema registration process, which registers XML schemas with the XML schema repository (XSR).

Authorization

The user that calls this stored procedure is considered the creator of this XML schema. DB2® obtains the namespace attribute from the schema document when XSR_COMPLETE is invoked.

The privileges held by the authorization ID of the statement must include the following:
  • The following system authorities:
    • The system authority *EXECUTE on the service program associated with the procedure, and
    • The system authority *EXECUTE on the SYSPROC library.
The privileges held by the authorization ID of the statement must include as least one of the following:
  • The privilege to create in the schema
  • Start of changeDatabase administrator authorityEnd of change
The privileges held by the authorization ID of the statement must include at least one of the following:
  • For the XSROBJECTS, XSROBJECTCOMPONENTS, and XSROBJECTHIERARCHIES catalog tables:
    • The INSERT privilege on the table, and
    • The system authority *EXECUTE on library QSYS2.
  • Start of changeDatabase administrator authorityEnd of change

Syntax

Read syntax diagramSkip visual syntax diagramXSR_REGISTER(rschema, name,schemalocation,content ,docproperty)

Description

The schema is SYSPROC.

rschema
An input parameter of type VARCHAR(128) that specifies the SQL schema for the XML schema. It must be a valid SQL identifier. The SQL schema is one part of the qualified name used to identify this XML schema in the XSR. (The other part of the name is supplied by the name parameter). This parameter can have the NULL value which indicates that name is implicitly qualified based on the rules specified in Qualification of unqualified object names.
If rschema is specified, it cannot be QSYS, QSYS2, SYSIBM, SYSPROC, or QTEMP.
name
An input parameter of type VARCHAR(128) that specifies the name of the XML schema. It must be a valid SQL identifier. The complete name for the XML schema is rschema.name and should be unique among all objects in the XSR.
schemalocation
An input parameter of type VARCHAR(1000), which can have the NULL value, that indicates the schema location of the primary XML schema document. This parameter is the external name of the XML schema, that is, the primary document can be identified in the XML instance documents with the xsi:schemaLocation attribute.
content
An input parameter of type BLOB(30M) that contains the content of the primary XML schema document. This parameter cannot have the NULL value; an XML schema document must be supplied. The content of the XML schema document must be encoded in UTF-8.
docproperty
An input parameter of type BLOB(5M) that indicates the properties for the primary XML schema document. This parameter can have the NULL value; otherwise, the value is an XML document.

Example

The following example calls the XSR_REGISTER stored procedure:

  CALL SYSPROC.XSR_REGISTER(
    'MyLib',
    'MySchema',
    'http://myschema/primary.xsd',
    :content_host_var,
    :docproperty_host_var)