User Tools

Site Tools

A PCRE internal error occured. This might be caused by a faulty plugin

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

for-cursor

====== FOR Statement (Cursor Loop) - PL/HQL Reference ====== FOR statement opens a cursor, executes one or more statements repeatedly for each row and closes the cursor. Syntax: <code language=sql> FOR cur_name IN [(] select_stmt [)] LOOP statements END LOOP; </code> **Notes:** * You can refer to the cursor columns using //cur_name.col_name// syntax **Example:** <code language=sql> 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; </code> **Compatibility:** Oracle, PostgreSQL and Netezza **Version:** PL/HQL 0.03