Oracle Multimedia provides the ORD_DOC PL/SQL package. This package provides procedures to perform common operations such as importing and exporting media data to and from operating system files, and extracting information from media data. See Procedures Common to All Oracle Multimedia PL/SQL Package APIs for information about exporting and importing media data to and from operating system files. This package adds Oracle Multimedia support to audio, image, video, and other heterogeneous media data stored in BLOBs and BFILEs.
The ORD_DOC package is defined in the orddrpsp.sql
file. After installation, this file is available in the Oracle home directory at:
<ORACLE_HOME>
/ord/im/admin
(on Linux and UNIX)
<ORACLE_HOME>
\ord\im\admin
(on Windows)
The examples in these topics assume that the DOCDIR directory and these tables exist: TAUD, TDOC, TIMG, and TVID. (See Examples for Oracle Multimedia PL/SQL Packages for more information about the tables and directories used in these examples.)
See the following topics for details about the procedures in the ORD_DOC PL/SQL package:
Format
getProperties(docBfile IN OUT NOCOPY BFILE, attributes IN OUT NOCOPY CLOB);
Description
Reads the document data stored in a BFILE to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This procedure populates the CLOB with a set of format and application properties in XML form.
Parameters
Usage Notes
None.
Pragmas
None.
Exceptions
None.
Examples
Get the property information for known document attributes:
DECLARE doc_attrib CLOB; doc_data BFILE:=BFILENAME('DOCDIR','testvid.dat'); BEGIN DBMS_LOB.CREATETEMPORARY(doc_attrib, FALSE, DBMS_LOB.CALL); -- get properties from bfile ORDSYS.ORD_DOC.getProperties(doc_data, doc_attrib); -- print length of extracted properties DBMS_OUTPUT.PUT_LINE('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib))); EXCEPTION WHEN OTHERS THEN RAISE; END; /
Format
getProperties(docBfile IN OUT NOCOPY BFILE, mimeType OUT VARCHAR2, format OUT VARCHAR2, contentLength OUT INTEGER);
Description
Reads the document data stored in a BFILE to get the values of the media attributes for supported formats, and then returns them as explicit parameters. This procedure extracts the properties for these attributes of the document data: MIME type, content length, and format.
Parameters
Usage Notes
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
Pragmas
None.
Exceptions
None.
Examples
Get the property information for known document attributes:
DECLARE doc_data BFILE:=BFILENAME('DOCDIR','testimg.dat'); doc_mimeType VARCHAR2(80); doc_format VARCHAR2(32):=NULL; doc_contentLength NUMBER; BEGIN -- get properties from bfile ORDSYS.ORD_DOC.getProperties(doc_data, doc_mimeType, doc_format, doc_contentLength); -- print properties DBMS_OUTPUT.PUT_LINE('mimeType: ' || doc_mimeType ); DBMS_OUTPUT.PUT_LINE('format: ' || doc_format ); DBMS_OUTPUT.PUT_LINE('contentLength: ' || doc_contentLength ); EXCEPTION WHEN OTHERS THEN RAISE; END; /
Format
getProperties(docBlob IN BLOB, attributes IN OUT NOCOPY CLOB);
Description
Reads the document data stored in a BLOB to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This procedure extracts the properties for these attributes of the document data: MIME type, content length, and format. This procedure populates the CLOB with a set of format and application properties in XML form.
Parameters
Usage Notes
None.
Pragmas
None.
Exceptions
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the input docBLOB parameter is NULL.
Examples
Get the property information for known document attributes:
DECLARE doc_attrib CLOB; doc_data BLOB; BEGIN SELECT document,attributes INTO doc_data,doc_attrib FROM tdoc WHERE N=1 FOR UPDATE; -- get properties from blob ORDSYS.ORD_DOC.getProperties(doc_data, doc_attrib); -- print length of extracted properties DBMS_OUTPUT.PUT_LINE('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(doc_attrib))); UPDATE tdoc SET document=doc_data, attributes=doc_attrib WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
Format
getProperties(docBLOB IN BLOB, mimeType OUT VARCHAR2, format OUT VARCHAR2, contentLength OUT INTEGER);
Description
Reads the document data stored in a BLOB to get the values of the media attributes for supported formats, and then returns them as explicit parameters. This procedure extracts the properties for these attributes of the document data: MIME type, content length, and format.
Parameters
Usage Notes
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
Pragmas
None.
Exceptions
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the input docBLOB parameter is NULL.
Examples
Get the property information for known document attributes:
DECLARE doc_data BLOB; doc_mimeType VARCHAR2(80); doc_format VARCHAR2(32):=NULL; doc_contentLength NUMBER; BEGIN SELECT document, mimetype, format, contentlength INTO doc_data, doc_mimeType, doc_format, doc_contentLength FROM tdoc WHERE N=1 FOR UPDATE; -- get properties from blob ORDSYS.ORD_DOC.getProperties(doc_data, doc_mimeType, doc_format, doc_contentLength); -- print properties DBMS_OUTPUT.PUT_LINE('mimeType: ' || doc_mimeType ); DBMS_OUTPUT.PUT_LINE('format: ' || doc_format ); DBMS_OUTPUT.PUT_LINE('contentLength: ' || doc_contentLength ); UPDATE tdoc SET document=doc_data, mimetype=doc_mimeType, format=doc_format, contentlength=doc_contentLength WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /