| Previous | Next |  | Contents | Index | Glossary

## Standard API for a "PL/SQL" Document

You can integrate a document into a workflow process by defining an attribute of type document for an item type, message, or activity. One type of document that Oracle Workflow supports is a "PL/SQL" document. The document-type attribute that you create tells Oracle Workflow how to construct a dynamic call to a PL/SQL procedure that generates the document. You can embed a PL/SQL document-type message attribute in a message body to display the document in a notification.

The PL/SQL procedure that generates the document must have the following standard API:

procedure <procedure name> ( | document_id | in varchar2,
|  |  |  | display_type | in varchar2,
|  |  |  | document | in out varchar2,
|  |  |  | document_type | in out varchar2)

The arguments for the procedure are as follows:

document_id | A string that uniquely identifies a document. This is the same string as the value that you specify in the default value field of the Attribute property page for a "PL/SQL" document (plsql:<procedure>/<document_identifier>). `<procedure>` should be replaced with the PL/SQL package and procedure name in the form of package.procedure. The phrase `<document_identifier>` should be replaced with the PL/SQL argument string that you want to pass directly to the procedure. The argument string should identify the document. For example: `plsql:po_wf.show_req/2034.` If you wish to generate the PL/SQL argument string value dynamically, create another item attribute, and reference that item attribute as "&item_attribute" in place of the PL/SQL argument string. Then before any activity that references this other item attribute gets executed, call the WF_ENGINE.SetItemAttribute API to dynamically set the PL/SQL argument string value. For example: `plsql:po_wf.show_req/&POREQ_NUMBER.`
display_type | One of three values that represents the content type used for the notification presentation, also referred to as the requested type:
| text/plain--the document is embedded inside a plain text representation of the notification as viewed from an e-mail message. The entire e-mail message must be less than or equal to 32K, so depending on how large your e-mail template is, some of the plain text document that the procedure generates may get truncated. See: Modifying Your Message Templates.
| text/html--the document is embedded inside an HTML representation of the notification as viewed from the Notification Web page, or the HTML attachment to an e-mail message. The procedure must generate a HTML representation of the document of up to 32K, but should not include top level HTML tags like <HTML> or <BODY> since the HTML page that the document is being inserted into already contains these tags. If you include top level HTML tags accidentally, Oracle Workflow removes the tags for you when the document attribute is referenced in a message body. Note that the procedure can alternatively generate a plain text document, as the notification system can automatically surround plain text with the appropriate HTML tags to preserve formatting.
| ' '--the document is presented as a separate attachment to the notification. Any content type may be returned.
document | The outbound text buffer where up to 32K of document text is returned.
document_type | The outbound text buffer where the document content type is returned. Also referred to as the returned type. If no type is supplied, then 'text/plain' is assumed.

### See Also

To Define a Document Attribute

| Previous | Next |  | Contents | Index | Glossary