%rowcount - implicit cursor attributes, PL-SQL Programming

%ROWCOUNT

The %ROWCOUNT yields the number of rows affected by the INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement. The %ROWCOUNT yields zero when an

INSERT, UPDATE, or DELETE statement affected no rows, or the SELECT INTO statement return no rows. In the illustration below, you use the %ROWCOUNT to take the action if more than ten rows have been deleted:

DELETE FROM emp WHERE ...

IF SQL%ROWCOUNT > 10 THEN -- more than 10 rows were deleted

...

END IF;

If the SELECT INTO statement precedes more than one row, the PL/SQL raises the predefined exception TOO_MANY_ROWS and the %ROWCOUNT yields 1, not the actual number of rows that assure the query.

Posted Date: 10/4/2012 4:48:38 AM | Location : United States







Related Discussions:- %rowcount - implicit cursor attributes, Assignment Help, Ask Question on %rowcount - implicit cursor attributes, Get Answer, Expert's Help, %rowcount - implicit cursor attributes Discussions

Write discussion on %rowcount - implicit cursor attributes
Your posts are moderated
Related Questions
JOIN and AND in SQL In this Section is all about one operator, JOIN. SQL's closest counterpart, NATURAL JOIN, has already been covered. Here we look at several other "join" op

Declaring Subprograms   You can declare subprograms in any PL/SQL subprogram, block, or package. But, you should declare subprograms at the end of the declarative part after a

Declaring a Cursor The Forward references are not allowed in the PL/SQL. Therefore, you must declare a cursor before referencing it in other statements. Whenever you declare a

Deriving Predicates from Predicates in SQL The corresponding section in the theory book describes how predicates can be derived from predicates using (a) the logical connectiv

OUT Mode An OUT parameter returns values to the caller of a subprogram. Within the subprogram, an OUT parameter act like a variable. That means that you can use an OUT formal

Create a Oracle procedure to produce vertical output format when selecting rows from a database table.

Naming Conventions The similar naming conventions apply to all PL/SQL program items and units including the variables, cursors, constants, cursor variables, procedures, exception

Keyword and Parameter Description: table_reference: This specifies a table or view that should be accessible when you execute the DELETE statement, and for that you must

Parameter Aliasing   To optimize the subprogram call, the PL/SQL compiler can decide between the two techniques of the parameter passing. With the by-value techniques, the v

Indeterminacy in SQL Some SQL expressions are actually not function invocations at all in the mathematical sense, being indeterminate-invocations operating on identical input