开发者

Oracle Forms - Host Command - Return Error Code

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 suggestio开发者_Python百科ns of the code I need to add?

Thank you.


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;


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.


You still can get the error message by using this statement HOST(vCommand || ' > error.txt');

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜