Is it possible to concatenate the .jpg filename in order to upload several images to a table?
I want it to do it with a cursor.
Here is the code:
CREATE OR REPLACE PROCEDURE upload_pics AS
CURSOR c_id IS
SELECT DISTINCT id_pic
FROM id_table;
r_id c_id%rowtype;
v_blob BLOB;
v_bfile BFILE;
BEGIN
FOR r_id IN c_id LOOP
v_bfile := bfilename('TMP_DIR', r_id.id_pic || '.jpg');
dbms_lob.open(v_bfile, dbms_lob.lob_readonly);
dbms_lob.loadfromfile(v_blob, v_bfile, dbms_lob.getlength(v_bfile));
UPDATE pic_table
SET
picture = v_blob
WHERE
id = r_id.id_pic;
dbms_lob.close(v_bfile);
END LOOP;
END;
Yes possible, here's is an alternative way which worked for me :