|Oracle® interMedia Reference
10g Release 1 (10.1)
Part Number B10829-01
ctx IN OUT RAW,
startPos IN INTEGER,
numBytes IN OUT INTEGER,
buffer IN RAW);
Lets you write a buffer of n bytes to a source beginning at a start position.
The source plug-in context information. This should be allocated and initialized to NULL. If you are using a user-defined source plug-in, you should call the openSource( ) method. See the introduction to this chapter for more information.
The start position in the source to where the buffer should be copied.
The number of bytes to be written to the source.
The buffer of data to be written.
This method assumes that the source lets you write n number of bytes starting at a random byte location. The file and HTTP source types will not permit you to write, and do not support this method. This method will work if data is stored in a local BLOB or is accessible through a user-defined source plug-in.
This exception is raised if you call the writeToSource( ) method and the value of the source.srcType attribute is NULL.
This exception is raised if you call the writeToSource( ) method and the value of source.local is 1 or NULL (TRUE), but the value of the source.localData attribute is NULL.
Replace <object-type> with the object type to which you apply this method.
This exception is raised if you call the writeToSource( ) method and this method is not supported by the source plug-in being used.
This exception is raised if you call the writeToSource( ) method and the source plug-in raises an exception.
See Appendix F for more information about these exceptions.
Write a buffer to the source:
DECLARE obj ORDSYS.ORDAudio; n INTEGER := 6; ctx RAW(64) :=NULL; BEGIN SELECT p.product_audio INTO obj FROM pm.online_media p WHERE p.product_id = 1743 FOR UPDATE; obj.writeToSource(ctx,1,n,UTL_RAW.CAST_TO_RAW('helloP')); UPDATE pm.online_media p SET p.product_audio = obj WHERE p.product_id = 1743; DBMS_OUTPUT.PUT_LINE('Length is ' || TO_CHAR(obj.getContentLength(ctx))); -- Roll back the transaction to keep the sample schema unchanged. ROLLBACK; EXCEPTION WHEN ORDSYS.ORDSourceExceptions.METHOD_NOT_SUPPORTED THEN DBMS_OUTPUT.PUT_LINE('ORDSourceExceptions.METHOD_NOT_SUPPORTED caught'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('EXCEPTION caught'); END; /