Home » Developer & Programmer » Forms » Getting error when I cancel file selection in file open dialogue (oracle 9.2.0.3 , forms 10g)
Getting error when I cancel file selection in file open dialogue [message #447897] Thu, 18 March 2010 06:36 Go to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
I have created the below stored procedure and calling the procedure in when-button-pressed trigger.
Problem here is that when I cancel the file selection in file open dialogue box its raising exception.
How can avoid this?
PROCEDURE TEST
IS
   buffer_lines      client_text_io.file_type;
   v_outputstr       VARCHAR2 (32767);
   p_delimiter       VARCHAR2 (10)            := '","';
   v_transaction_no  VARCHAR2 (10);
  
  
BEGIN     
    fname := CLIENT_GET_FILE_NAME('C:\', NULL,'Text File (*.*)|*.*|','Open:',OPEN_FILE,true);  
    buffer_lines := client_text_io.fopen ( fname, 'r');   
    LOOP
      BEGIN
        
         client_text_io.get_line (buffer_lines, v_outputstr);         
         v_outputstr := REPLACE (v_outputstr, '"');
         v_transaction_no := SUBSTR (v_outputstr, 1, INSTR (v_outputstr, ',', 1) - 1); 

        
         UPDATE order
            SET status_date = SYSDATE
          WHERE tran_nbr = TRIM (TO_CHAR (v_transaction_no)) ;

      EXCEPTION
         WHEN NO_DATA_FOUND
         THEN
            client_text_io.fclose (buffer_lines);
         EXIT;
      END;
   END LOOP;

   COMMIT;          
                         
EXCEPTION  
  
  WHEN OTHERS
   THEN
     message_popup ('Error ' || SQLERRM, 'E', TRUE);   
     RAISE form_trigger_failure;
END; 
Re: Getting error when I cancel file selection in file open dialogue [message #447901 is a reply to message #447897] Thu, 18 March 2010 06:49 Go to previous messageGo to next message
tamzidulamin
Messages: 132
Registered: October 2009
Location: Dhaka
Senior Member
Dear,

when u cancel file selection dialog box, then
your fname will be NULL.

so u include

If fname is not null then 
         buffer_lines := client_text_io.fopen ( fname, 'r'); 
        Loop
       ----------------------
       ----------------------
        End loop;
      End if;


Regards
Tamzidul Amin.
Re: Getting error when I cancel file selection in file open dialogue [message #447902 is a reply to message #447901] Thu, 18 March 2010 06:52 Go to previous messageGo to next message
prachij593
Messages: 266
Registered: May 2009
Senior Member
I did this way also but when filename is null it would go for other exception.Right? How to handle this?
Re: Getting error when I cancel file selection in file open dialogue [message #448247 is a reply to message #447897] Mon, 22 March 2010 05:19 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why would it raise an exception if you code it so that it won't do anything when fname is null?
Previous Topic: how to create a button to open directory
Next Topic: WebUtil client_get_file_name
Goto Forum:
  


Current Time: Fri Sep 20 10:30:50 CDT 2024