Passing cursor parameters, PL-SQL Programming

Passing Cursor Parameters

You use the OPEN statement to pass the parameters to a cursor. Unless you want to accept the default values, each proper parameter in the cursor declaration should have a parallel actual parameter in the OPEN statement. For illustration, given is the cursor declaration

DECLARE

emp_name emp.ename%TYPE;

salary emp.sal%TYPE;

CURSOR c1 (name VARCHAR2, salary NUMBER) IS SELECT ...

any of the statements below opens the cursor:

OPEN c1(emp_name, 3000);

OPEN c1('ATTLEY', 1500);

OPEN c1(emp_name, salary);

In the last illustration, if the identifier salary is used in the cursor declaration, it refers to the proper parameter. But, if it is used in the OPEN statement, it refers to the PL/SQL variable. To keep away from the uncertainty, use the exclusive identifiers.

The Formal parameters declared with a default value need not have a parallel actual parameter. They can simply suppose their default values when the OPEN statement is executed.

Posted Date: 10/4/2012 3:53:08 AM | Location : United States







Related Discussions:- Passing cursor parameters, Assignment Help, Ask Question on Passing cursor parameters, Get Answer, Expert's Help, Passing cursor parameters Discussions

Write discussion on Passing cursor parameters
Your posts are moderated
Related Questions
Autonomous versus Nested Transactions Though an autonomous transaction is started by the other transaction, it is not a nested transaction for the reasons shown below: (i)

Parameter and Keyword Description: cursor_variable_name: This identifies a cursor variable or the parameter formerly declared within the present scope. host_cursor_va

Comparison Operators Usually, you use the comparison operators in the WHERE clause of a data manipulation statement to form the predicates, that compare one expression to anot

Using DELETE This process has three forms. The DELETE removes all elements from the collection. DELETE(n) removes the nth element from the nested table. When n is null, then D

How Calls Are Resolved? The figure shows that how the PL/SQL compiler resolves the subprogram calls. When the compiler encounters the procedure or function call, it tries to di

Example of Alternative formulation as a table constraint Example: Alternative formulation as a table constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Must_be_enrolled_to_

Semidifference via NOT IN and a subquery SELECT StudentId FROM IS_CALLED WHERE Name = 'Devinder' AND StudentId NOT IN (SELECT StudentId FROM IS_ENROLLED_ON WHER

Defining REF CURSOR Types To make cursor variables, you take 2 steps. At first, you define a REF CURSOR type, and then declare the cursor variables of that type. You can defin

Write SQL queries to solve the following specifications. Include the query AND THE OUTPUT.  A screen dump of the output is acceptable. Show as many rows as you can. A screen dump i

CLOSE Statement The CLOSE statement allows the resources held by a cursor variable or open cursor to be reused. No more rows can be fetched from the cursor variable or closed