User Tools

Site Tools


Sidebar

HPL/SQL is included to Apache Hive since version 2.0

hostcode

HOSTCODE

HOSTCODE built-in variable contains the return code of the last OS command.

SET hplsql.onerror = SETERROR;
 
HOST 'echo hello, world';
IF HOSTCODE <> 0 THEN
  PRINT 'Error';
END IF;

Notes:

  • Typically HOSTCODE is 0 when the process terminated successfully, and 1 if it terminated with an error.
  • By default hplsql.onerror is set to EXCEPTION, so if the OS command cannot be executed (the process does not exist, no permissions i.e.) the exception is raised and you are not be able to check HOSTCODE in IF statement.

For more information, see Error Handling.

Compatibility: HPL/SQL Extension.

See also: