User Tools

Site Tools


Sidebar

HPL/SQL is included to Apache Hive since version 2.0

hostcode

This is an old revision of the document!


HOSTCODE - PL/HQL Reference

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

SET plhql.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 plhql.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: PL/HQL Extension.

See also: