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
Name Resolution   During the compilation, the PL/SQL compiler relates identifiers like the name of a variable with an address or memory location, actual value, or datatype. Th

Existential Quantification - SQL Existential quantification-stating that something is true of at least one object under consideration-can be expressed by OR(r,c), meaning tha

Problem: (a) Define the following terms: (i) data mining. (ii) OLAP. (b) Differentiate between snowflake schema and star schema. Support your answer with appropriate

Entering and Exiting If you enter the executable part of an autonomous routine, the major transaction suspends. When you exit the routine, the major transaction resumes. To ex

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that acce

Mutual Recursion The Subprograms are mutually recursive if they directly or indirectly call each other. In the illustration below, the Boolean functions odd & even, that dete

Assignment Statement: The assignment statement sets the present value of the variable, parameter, field, or element. The statement consists of an assignment target followed by

Write a pl/sql block that declares and uses cursors with parameters. In a loop, use a cursor to retrieve the department number and the department name from the departments table

I want to implement heap sort algorithm in pl sql please share the source code for guidance

Overview of control structures According to the structure theorem, any computer program can be written by using the basic control structures as shown in figure below. They can b