Using %rowtype-declarations in sql, PL-SQL Programming

Using %ROWTYPE

The %ROWTYPE attribute gives a record type which represents a row in a table (or view). The record can store the whole row of data selected from the table or fetched from a cursor or strongly typed cursor variable. In the illustration below, you declare two records. The first record stores a row selected from an emp table. The second record stores a row that is fetched from the cursor c1.

DECLARE
emp_rec emp%ROWTYPE;
CURSOR c1 IS SELECT deptno, dname, loc FROM dept;
dept_rec c1%ROWTYPE;

The Columns in a row and corresponding fields in a record have the same names and
datatypes. Though, fields in a %ROWTYPE record do not inherit the NOT NULL column constraint.
In the example below, you select column values into record emp_rec:
BEGIN
SELECT * INTO emp_rec FROM emp WHERE...

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







Related Discussions:- Using %rowtype-declarations in sql, Assignment Help, Ask Question on Using %rowtype-declarations in sql, Get Answer, Expert's Help, Using %rowtype-declarations in sql Discussions

Write discussion on Using %rowtype-declarations in sql
Your posts are moderated
Related Questions
Project Description: I want somebody who can help me with an idea that I have been working on for a few months now. The person will require extensive knowledge of warcraft 3 PvP

IS NULL Operator The IS NULL operator returns the Boolean value TRUE whenever its operand is null or FALSE if it is not null. The comparisons including the nulls always yield NU

Explicitly specifying the join condition - SQL SELECT * FROM IS_CALLED JOIN IS_ENROLLED_ON ON ( IS_CALLED.StudentId = IS_ENROLLED_ON.StudentId ) Now, the key word JO

IN Operator The operator IN tests the set membership. This means "equal to any member of." The set may have nulls, but they are ignored. For illustration, the statement below do

Stored Subprograms Normally, tools (like Oracle Forms) which incorporate the PL/SQL engine can store subprograms locally for later, strictly local execution. Though, to become

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

Question 1 . Compare SQL and PL/SQL Question 2 . Write a database trigger to implement the following check condition                          Given the following table

Parameter and Keyword Description: collection_name: This keyword identifies the index-by table, nested table, or varray formerly declared within the present scope. cu

Table Literals - SQL One might expect SQL to support table literals in the manner illustrated in Example 2.2, but in fact that is not a legal SQL expression. Example: Not a

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