我正在尝试提取BLOB
数据并将其转换为原始文件(pdf、rtf、doc 等)。下面是我的代码:
DECLARE
l_file UTL_FILE.FILE_TYPE;
l_buffer RAW(32767);
l_amount BINARY_INTEGER := 32767;
l_pos NUMBER := 1;
l_blob BLOB;
l_blob_len NUMBER;
BEGIN
SELECT file_contents
INTO l_blob
FROM irb_files
WHERE FILE_NAME = 'STD_FlipBook_Religion2013.doc';
l_blob_len := DBMS_LOB.getlength(l_blob);
-- Open the destination file.
l_file := UTL_FILE.fopen('IRB','STD_FlipBook_Religion2013.doc','wb','W');
DBMS_LOB.read(l_blob, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw(l_file, l_buffer, TRUE);
l_pos := l_pos + l_amount;
-- Close the file.
UTL_FILE.fclose(l_file);
END;
我对这一切都比较陌生,所以如果我的代码有点不对劲,我很抱歉。我不断收到的错误是:
Error report:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 18
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause:
*Action:
任何帮助将不胜感激。
数据库信息:Oracle9i Enterprise Edition Release 9.2.0.5.0