If the requirement is just to store a string, I would recommend CLOB instead of BLOB, as to store text in BLOB column, it has to be cast to RAW. The retrieval is equally complicated.
It can't be done in SQL, as 4000 characters is the maximum you can assign to a string field. However, here is my workaround using a small Pl/Sql Block (In Pl/Sql, maximum of 32767 characters.
CREATE TABLE clob_ins_test (
clob_column CLOB
);
/
Table CLOB_INS_TEST created.
SET SERVEROUTPUT ON;
DECLARE
v_long_text VARCHAR2( 5000 );
BEGIN
v_long_text := LPAD( '1', 3500, '1' ) || LPAD( '1', 600, '1' ); /* Assign your string value here as v_long_text := '/9j/4AAQSkZJRgABAgA...2Q=='*/
dbms_output.put_line( 'Length of String is ' || length( v_long_text ) ); -- Printing the length of the String assigned to v_long_text.
INSERT INTO clob_ins_test VALUES ( v_long_text );
END;
/
Length of String is 4100
PL/SQL procedure successfully completed.
SELECT dbms_lob.getlength( clob_column ) Length, clob_column FROM CLOB_INS_TEST;
LENGTH CLOB_COLUMN
---------- --------------------------------------------------------------------------------
4100 11111111111111111111111111111111111111111111111111111111111111111111111111111111
Hope this helps!