"In the first place i want to congratulate you on this wonderful game, but the real reason that i'm writing is because i don't agree with the answer to the 11 June quiz in which you asked: Which of the following choices correctly names a schema-level program or packaged subprogram provided by Oracle that you can use to determine if a file exists?
"In my opinion you can use UTL_FILE.IS_OPEN to determine if the file exists or not (i know that you can not use it by itself but in fact in one situation that you have already tried to open a file you can use it to check the existence).
If you use it in conjunction with utl_file.fopen you can find out if the file exists or not...
DECLARE vInHandle utl_file.file_type; BEGIN vInHandle := utl_file.fopen('ORALOAD', 'test.txt', 'R'); IF utl_file.is_open(vInHandle) THEN dbms_output.put_line('The File exists'); Else dbms_output.put_line('The File dosen't exists'); END IF; END fopen;
Miguel, we salute your creativity! All too often, developers stick to the documented and "intended" purpose of a program and don't explore other ways that it can be applied to solve a problem.
So, by all means, please keep exploring and pushing boundaries.
In this case, however, we must disagree. The IS_OPEN subprogram of UTL_FILE will only tell you if a file is open or not (and even then, so far as we know, this function only checks the value of a field in the UTL_FILE.FILE_TYPE record; it doesn't actually check file status). If the file doesn't exist, it will not be opened and so you never even get to call IS_OPEN.