Skip to content

Instantly share code, notes, and snippets.

@luistangui
Created September 18, 2015 13:58
Show Gist options
  • Save luistangui/272ea6424843d1534bbe to your computer and use it in GitHub Desktop.
Save luistangui/272ea6424843d1534bbe 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;
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment