[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

07/12/2007 at 07:25AM PDT, ID: 22691787
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

utl_file.INVALID_OPERATION error

Asked by ewang1205 in Oracle Database

Tags: utl_file

Hi, Experts,

I have a PROCEDURE to open a flat file.  The following is code;

 v_check_FHandle        UTL_FILE.FILE_TYPE;
  v_input_dir            varchar2(100) :='DEPWORK';
  v_input_file            varchar2(100);
  v_check_stmt               VARCHAR2(2000);
  v_check_cnt           number:=0;
  v_check_flag          boolean := TRUE;

      ---------------------------------------------
      -- Checking the Existance of the file
      ---------------------------------------------
begin
      BEGIN
      v_input_file := 'test_data.out';
          v_check_FHandle := utl_file.fopen(v_input_dir,v_input_file,'R');
          utl_file.get_line(v_check_FHandle, v_check_stmt);
          v_check_cnt := v_check_cnt + 1;
          utl_file.fclose(v_check_Fhandle);
          IF v_check_cnt > 0 then
            v_check_flag := FALSE;
          END IF;
        EXCEPTION
          When NO_DATA_FOUND then
          -- the file exists, but has zero bytes
          utl_file.fclose(v_check_Fhandle);
            v_check_flag := TRUE;
  WHEN utl_file.invalid_mode THEN
    RAISE_APPLICATION_ERROR (-20051, 'Invalid Mode Parameter');
  WHEN utl_file.invalid_path THEN
    RAISE_APPLICATION_ERROR (-20052, 'Invalid File Location');
  WHEN utl_file.invalid_filehandle THEN
    RAISE_APPLICATION_ERROR (-20053, 'Invalid Filehandle');
  WHEN utl_file.invalid_operation THEN
    RAISE_APPLICATION_ERROR (-20054, 'Invalid Operation');
  WHEN utl_file.read_error THEN
    RAISE_APPLICATION_ERROR (-20055, 'Read Error');
  WHEN utl_file.internal_error THEN
    RAISE_APPLICATION_ERROR (-20057, 'Internal Error');
  WHEN utl_file.charsetmismatch THEN
    RAISE_APPLICATION_ERROR (-20058, 'Opened With FOPEN_NCHAR
    But Later I/O Inconsistent');
 WHEN utl_file.file_open THEN
    RAISE_APPLICATION_ERROR (-20059, 'File Already Opened');
 WHEN utl_file.invalid_maxlinesize THEN
    RAISE_APPLICATION_ERROR(-20060,'Line Size Exceeds 32K');
 WHEN utl_file.invalid_filename THEN
    RAISE_APPLICATION_ERROR (-20061, 'Invalid File Name');
 WHEN utl_file.access_denied THEN
    RAISE_APPLICATION_ERROR (-20062, 'File Access Denied By');
 WHEN utl_file.invalid_offset THEN
    RAISE_APPLICATION_ERROR (-20063,'FSEEK Param Less Than 0');
 WHEN others THEN
    RAISE_APPLICATION_ERROR (-20099, 'Unknown UTL_FILE Error');
     end;
    BEGIN
   -- Open the input file for reading
   if v_check_flag then
   v_check_FHandle:=UTL_FILE.FOPEN(v_input_dir,v_input_file,'R');
   end if;
   DBMS_OUTPUT.PUT_LINE('File Opened for read.');
    end;
end;

When I run this in sqlplus, I got a error:
PLS-00483: exception 'INVALID_OPERATION' may appear in at most one exception handler in this block

Please help.  Thanks!

[+][-]07/12/07 07:44 AM, ID: 19472247

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07/12/07 07:49 AM, ID: 19472317

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/12/07 07:56 AM, ID: 19472414

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: utl_file
Sign Up Now!
Solution Provided By: nav_kum_v
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07/12/07 07:56 AM, ID: 19472417

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91