Updating clob in pl sql anime dating flash game
If the record does not exist, I would do the folloving: ----------------------- INSERT INTO sam_emp (id, resume) VALUES (sam_emp_seq.nextval, empty_blob()) RETURNING id INTO my_id; COMMIT; SELECT resume INTO dst_file FROM sam_emp WHERE ID = my_id FOR update; dbms_lob.fileopen(src_file, dbms_lob.file_readonly); lgh_file := dbms_lob.getlength(src_file); dbms_lob.loadfromfile(dst_file, src_file, lgh_file); COMMIT; dbms_lob.fileclose(src_file); ----------------------- So, I introduce a few more elements here - sam_emp_seq - sequencer to generate ID values for sam_- id - column in sam_emp table that will be used as the primary key - empty_blob() - built-in function to set valid empty BLOB locator - my_id - a variable to hold the value of ID generated by the sequencer in INSERT statement. LOADFROMFILE procedure is doing the update for you. If you code an application, you will have to use streams to deal with BLOBs, while with VARCHAR2 you won't.
--------------------- Igor Obradovic Hi Igor, Thanks for your response. But i just wonder how it is gonna update that column without update clause ?? One more thing is ,i am able to upload , ,files into that column but not ,i able to execute the proc successfully but whn i try to view the file it is saying file is damaged . Is this the problem with the adobe version that i am using or something else ? Concerning the PDF, I'm not sure what's wrong there..
// For (4), remove the trigger body code that updates the LOB value.
Hi, Just remove these lines from your program: 25 UPDATE sam_emp 26 SET resume = dst_file ; Leave COMMIT (this is to save the changes and to release the lock on "FOR UPDATE") That should be all, and your program should run properly. LOADFROMFILE procedure already copies the data drom file to BLOB, there's no need for UPDATE statement.
Once you create an Oracle Lob instance corresponding temporary LOB appears on the server, and any data you insert into the object is sent immediately to server.
An example of using temporary LOBs you will see later in the article. Write() methods to transfer data to and from server.
You can retrieve values of LOB fields using Oracle Data Reader as well as other types like LONG and LONG RAW. Be careful, and specify WHERE clause to select only ONE record at the time, otherwise you will get an exception. I also can't see what you do to initialize BLOB column.