Skip to content

Instantly share code, notes, and snippets.

@mdfaramawy
Forked from luistangui/exec_cmd.prc
Last active June 2, 2020 08:12
Show Gist options
  • Save mdfaramawy/2aff77fb6e75d7b3db9e56bc217062ac to your computer and use it in GitHub Desktop.
Save mdfaramawy/2aff77fb6e75d7b3db9e56bc217062ac to your computer and use it in GitHub Desktop.
Execute Host Shell Command / Oracle Forms 11g
PROCEDURE EXEC_CMD(command varchar2) IS
stnd WEBUTIL_HOST.OUTPUT_ARRAY ;
error WEBUTIL_HOST.OUTPUT_ARRAY ;
process WEBUTIL_HOST.PROCESS_ID ;
pass PLS_INTEGER := 0 ;
result varchar2(10000);
BEGIN
process := WEBUTIL_HOST.Blocking(command);
stnd := WEBUTIL_HOST.Get_Standard_Output(process);
If stnd.count > 0 Then
--pass := 6 ;
For i in stnd.first .. stnd.last Loop
result:= result || stnd(i) || CHR(10) ;
End loop ;
End if ;
error := WEBUTIL_HOST.Get_Standard_Error(process);
If error.count > 0 Then
--pass := 6 ;
result := result || ' !!! E R R O R !!!' || CHR(10) ;
For i in error.first .. error.last Loop
result := result || error(i) || CHR(10) ;
End loop ;
End if ;
If process.handle is not null Then
WEBUTIL_HOST.Release_Process(process);
End if;
--https://technology.amis.nl/2016/12/23/executing-command-line-scripts-from-the-oracle-forms-client-using-webutil/
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment