I have a problem with my code (bellow), with assumption the path 'E:\Oracle\test' doesn't exist (the psychical folder doesn't exist), so it should go to the error exception handler and write an error log, but it doesn't. Instead it successfully create the Oracle Directory, why does this happen? where do my code went wrong?
Can someone please help me, thanks a lot The database is Oracle 11g
DECLARE
var1 VARCHAR2(2000) := 'somepath';
var2 VARCHAR2(2000) := 'directoryname';
err VARCHAR2(2000);
BEGIN
file_path_ := 'E:\Oracle\test\' || var1 || '\';
temp_dir_ := 'TEST_DIR_' || var2;
plsql_block_ := 'CREATE OR REPLACE DIRECTORY ' || temp_dir_ || ' AS ' || '''' ||file_path_ || '''';
EXECUTE IMMEDIATE plsql_block_;
SAVEPOINT Start_Trans;
<some code here>
EXCEPTION
WHEN OTHERS THEN
ROLLBACK TO Start_Trans;
err := substr(SQLERRM,1,2000);
Write_Log('ERROR', var1, err_);
END;