WUC-14 was occurring when developer was trying to write a file with more than 10000 lines as below.
Following solution was used for it.
ERROR>WUC-14 [getFromObjectCache] Object Cache Error: Specified object handle -1 not found in the cache
ERROR>WUC-12 [FileFunctions.put()] Object Cache Error: Object is not the expected BufferedWriter type
If writing 10920 or lesser lines to the text file using CLIENT_TEXT_IO.PUT_LINE, it works fine and no errors in the java console or form.
If writing 10921 or 10922 lines to the text file using CLIENT_TEXT_IO.PUT_LINE, the form crashes with FRM-92101 error.
If writing more than 10922 lines to the text file using CLIENT_TEXT_IO.PUT_LINE, then the chunk(s) of 10923 lines is(are) overwritten by next set of lines and java console shows the above mentioned error but no error in the form.
There is already a bug logged on this issue. It is Bug:4726166 - Webutil : Cannot Output Many Lines Using Client_Text_Io.Put_Line .
Use one of the following two workarounds :
v_errmsg varchar2(300);
v_Val INTEGER;
v_Filename client_text_io.file_type;
i number := 0;
CURSOR cur_emp IS
select rpad(EMPNO,10,' ')|| rpad(ENAME,20,' ') || rpad(JOB,20,' ')|| rpad(MGR,20,' ') ||
rpad(to_char(HIREDATE,'dd-Mon-yyyy hh24:mi:ss'),25,' ') || rpad(to_char(SAL),10,' ')||
rpad(to_char(COMM),10,' ') || rpad(to_char(DEPTNO),10,' ') as emp_info
from emp
order by empno,mgr,deptno;
begin
v_filename := client_text_io.fopen('C:\all_emps.txt','W');
FOR v_cursor in cur_emp
LOOP
client_text_io.PUT_LINE(v_filename,v_cursor.emp_info);
-- the following 4 lines of code are added as a workaround to the above mentioned bug.
i := i + 1;
if mod(i,10000) = 0 then
synchronize;
end if;
END LOOP;
client_text_io.FCLOSE(V_FilePointer);
EXCEPTION
WHEN OTHERS THEN
client_text_io.FCLOSE(V_FilePointer);
v_errmsg := SQLERRM;
message('v_errormsg = '||v_errmsg);
END;
Ref: 341899.1
WUC-14 Object Cache Error: Specified object handle {0} not found in the cache.
Type: User
Description: WebUtil tried to read an object from the object cache but no object was found at that position.
Resolution: Check that you have not already destroyed the
object before this call.
Following solution was used for it.
Symptoms
While writing more than approximately 10922 lines into a text file to the client machine using "CLIENT_TEXT_IO" package of webutil, it throws the following error in java console with no error in forms:ERROR>WUC-14 [getFromObjectCache] Object Cache Error: Specified object handle -1 not found in the cache
ERROR>WUC-12 [FileFunctions.put()] Object Cache Error: Object is not the expected BufferedWriter type
If writing 10920 or lesser lines to the text file using CLIENT_TEXT_IO.PUT_LINE, it works fine and no errors in the java console or form.
If writing 10921 or 10922 lines to the text file using CLIENT_TEXT_IO.PUT_LINE, the form crashes with FRM-92101 error.
If writing more than 10922 lines to the text file using CLIENT_TEXT_IO.PUT_LINE, then the chunk(s) of 10923 lines is(are) overwritten by next set of lines and java console shows the above mentioned error but no error in the form.
Cause
There is already a bug logged on this issue. It is Bug:4726166 - Webutil : Cannot Output Many Lines Using Client_Text_Io.Put_Line .
It seems that "CLIENT_TEXT_IO" package of webutil is writing to the text file(on the client box) in chunks of approx 10920 lines. Thus if more than 10920 lines are written then these lines are overwritten by the next chunk of lines.
Solution
Use one of the following two workarounds :- Write the required data into a text file on the Application Server machine using "TEXT_IO" package. Then transfer the text file to client machine using "WEBUTIL_FILE_TRANSFER.AS_TO_CLIENT" function.
- Add synchronize after every 10000 lines written to the text file on the client machine using "CLIENT_TEXT_IO" package.of webutil Please refer the following example code :
v_errmsg varchar2(300);
v_Val INTEGER;
v_Filename client_text_io.file_type;
i number := 0;
CURSOR cur_emp IS
select rpad(EMPNO,10,' ')|| rpad(ENAME,20,' ') || rpad(JOB,20,' ')|| rpad(MGR,20,' ') ||
rpad(to_char(HIREDATE,'dd-Mon-yyyy hh24:mi:ss'),25,' ') || rpad(to_char(SAL),10,' ')||
rpad(to_char(COMM),10,' ') || rpad(to_char(DEPTNO),10,' ') as emp_info
from emp
order by empno,mgr,deptno;
begin
v_filename := client_text_io.fopen('C:\all_emps.txt','W');
FOR v_cursor in cur_emp
LOOP
client_text_io.PUT_LINE(v_filename,v_cursor.emp_info);
-- the following 4 lines of code are added as a workaround to the above mentioned bug.
i := i + 1;
if mod(i,10000) = 0 then
synchronize;
end if;
END LOOP;
client_text_io.FCLOSE(V_FilePointer);
EXCEPTION
WHEN OTHERS THEN
client_text_io.FCLOSE(V_FilePointer);
v_errmsg := SQLERRM;
message('v_errormsg = '||v_errmsg);
END;
Ref: 341899.1
4 comments:
Wow.... really thanks... no one site explain mor extacly like this..... excelent... one more time Thakns
This saved me a lot of troubleshooting :)
Excellent explanation and solution, it helped me.
Thanks.
Wow really thanks !! for copy paste the oracle support note !!!!!!!!!
what a shame!
Post a Comment