- Can I use the following to convert from base64 to binary:
utl_encode.base64_decode(r IN raw) return raw;
- If so, what will be the datatype of the variable where I get the returned value (which is raw)? The max size that is allowed for a raw in PL/SQL is 32767 and the image size may be more than that.
PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,data IN RAW,mime_type IN VARCHAR2 DEFAULT 'application/octet',inline IN BOOLEAN DEFAULT TRUE,filename IN VARCHAR2 DEFAULT NULL,last IN BOOLEAN DEFAULT FALSE) IS i PLS_INTEGER; len PLS_INTEGER; BEGIN begin_attachment(conn, mime_type, inline, filename, 'base64'); i := 1; len := utl_raw.length(data); WHILE (i < len) LOOP IF (i + MAX_BASE64_LINE_WIDTH < len) THEN utl_smtp.write_raw_data(conn, utl_encode.base64_encode(utl_raw.substr(data, i, MAX_BASE64_LINE_WIDTH))); ELSE utl_smtp.write_raw_data(conn, utl_encode.base64_encode(utl_raw.substr(data, i))); END IF; utl_smtp.write_data(conn, utl_tcp.CRLF); i := i + MAX_BASE64_LINE_WIDTH; END LOOP; end_attachment(conn, last); END;
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.