views:

81

answers:

2

Within a Oracle Forms trigger I am using the host command to make a directory on the file server. An example of this part of my code is below:

HOST ('mkdir'||:GLOBAL.DIRECTORY_PATH||'\FERTILIZER\'||ADDY);

I need to have the error code returned to me if the directory is not created on the server. Any suggestions of the code I need to add?

Thank you.

+2  A: 

FORM_SUCCESS will return FALSE if the command fails for any reason (unless you're on Windows 95 in which case it will still return TRUE).

HOST('...');
IF NOT FORM_SUCCESS THEN
  MESSAGE('something went wrong');
END IF;
Jeffrey Kemp
+2  A: 

If you are looking for the actual OS level error code, then you are out of luck. The aforementioned answer from Jeffrey Kemp is the best you will get.

If you are having failures, keep in mind that the HOST built-in runs on the machine that actually runs the form (normally the application server). So, your command must be valid for the particular OS of the application server.

Also, and you may have figured this out already, in your example, 'mkdir'||:GLOBAL.DIRECTORY_PATH||'\FERTILIZER\'||ADDY could result in your command having no space between the command - mkdir and the string, resulting in a failed command.

Eddy B