User Tools

Site Tools


**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]]


====== Exceptions - PL/HQL Reference ====== PL/HQL allows you to handle exceptions in your programs. **Syntax:** <code language=sql> BEGIN -- Statements that can raise an exception EXCEPTION WHEN condition THEN -- Statements WHEN condition2 THEN -- Statements2 ... END </code> **Example**: <code language=sql> DECLARE v VARCHAR(200); BEGIN OPEN cur FOR 'SELECT c1 FROM t1'; FETCH cur INTO v; CLOSE cur; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('Error'); END </code> **Compatibility**: Oracle, PostgreSQL and Netezza.