User Tools

Site Tools


Sidebar

**HPL/SQL is included to Apache Hive since version 2.0** * [[home|Home]]\\ * [[why|Why HPL/SQL]]\\ * [[features|Key Features]]\\ * [[start|Get Started]]\\ * [[doc|HPL/SQL Reference]]\\ * [[download|Download]]\\ * [[new|What's New]]\\ * [[about|About]]

hostcode

====== HOSTCODE ====== HOSTCODE built-in variable contains the return code of the last OS command. <code language=sql> SET hplsql.onerror = SETERROR; HOST 'echo hello, world'; IF HOSTCODE <> 0 THEN PRINT 'Error'; END IF; </code> **Notes**: * Typically HOSTCODE is 0 when the process terminated successfully, and 1 if it terminated with an error. * By default [[configuration#hplsqlonerror|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|Error Handling]]. **Compatibility:** HPL/SQL Extension. **See also:** * [[sqlcode|SQLCODE]] * [[errorcode|ERRORCODE]]