Apache Hive : HPL/SQL - Execute OS Command or External Process

Last updated: August 12, 2026

Apache Hive : HPL/SQL - Execute OS Command or External Process

HPL/SQL allows you to execute an OS command or external process from a HPL/SQL script:

Syntax:

! command:

!cmd [arguments];

HOST statement:

HOST string_expr

Parameters:

ParameterDescription
cmdAny OS command or process
argumentsOptional argument list
string_exprCommand line for HOST statement

Notes:

  • Blank characters are allowed between ! and cmd
  • The ! command must be terminated by a semicolon (;)

Example:

Using ! command:

!echo Hello, world;

Using HOST statement:

HOST 'echo Hello, world';

Compatibility: Apache Hive (! command), Oracle (HOST statement).