Collections:
Pass a Parameter to a Cursor in Oracle
How To Pass a Parameter to a Cursor in Oracle?
✍: FYIcenter.com
When you define a cursor, you can set a formal parameter in the cursor. The formal parameter will be replaced by an actual parameter in the OPEN cursor statement. Here is a good example of a cursor with two parameters:
CREATE OR REPLACE PROCEDURE FYI_CENTER AS
CURSOR emp_cur(low NUMBER, high NUMBER)
IS SELECT * FROM employees WHERE salary >= low
AND salary <= high;
BEGIN
FOR row IN emp_cur(12000,15000) LOOP
DBMS_OUTPUT.PUT_LINE(row.first_name || ' '
|| row.last_name
|| ': ' || row.salary);
END LOOP;
END;
/
Nancy Greenberg: 12000
John Russell: 14000
Karen Partners: 13500
Alberto Errazuriz: 12000
Michael Hartstein: 13000
Shelley Higgins: 12000
⇒ What Is a Cursor Variable in Oracle
⇐ Open Multiple Cursors at the Same Time in Oracle
2018-07-18, 2430🔥, 0💬
Popular Posts:
Is SQL Server Transact-SQL case sensitive? No. Transact-SQL is not case sensitive. Like the standard...
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, y...
How AdventureWorksLT tables are related in SQL Server? There are 12 user tables defined in Adventure...
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...