SQL : insertion d'un CLOB via SQL
CREATE OR REPLACE DIRECTORY documents AS '/tmp';
SELECT monChampClob FROM uneTable WHERE monId=4000100;
DECLARE
l_bfile BFILE;
l_clob CLOB;
BEGIN
UPDATE uneTable
SET ILR_TARIF = EMPTY_CLOB()
WHERE monId=4000100
RETURNING ILR_TARIF INTO l_clob;
l_bfile := BFILENAME('DOCUMENTS', 'CGV.irl.txt');
DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
DBMS_LOB.loadfromfile(l_clob, l_bfile, DBMS_LOB.getlength(l_bfile));
DBMS_LOB.fileclose(l_bfile);
COMMIT;
END;
/
SELECT monChampClob FROM uneTable WHERE monId=4000100;
DROP DIRECTORY documents;
Aucun commentaire:
Enregistrer un commentaire