HPL/SQL is included to Apache Hive since version 2.0
FOR statement opens a cursor, executes one or more statements repeatedly for each row and closes the cursor.
FOR cur_name IN [(] select_stmt [)] LOOP statements END LOOP;
FOR item IN ( SELECT dname, loc as location FROM dept WHERE dname LIKE '%A%' AND deptno > 10 ORDER BY location) LOOP DBMS_OUTPUT.PUT_LINE('Name = ' || item.dname || ', Location = ' || item.location); END LOOP;
Compatibility: Oracle, PostgreSQL and Netezza
Version: PL/HQL 0.03