How to handle %rowtype(oracle) in teradata
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


How to handle %rowtype(oracle) in teradata Expand / Collapse
Author
Message
Posted 2/15/2008 6:36:17 AM


Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 11/19/2008 6:25:50 AM
Posts: 22, Visits: 61
A SAMPLE CODE IS GIVEN.









DECLARE
Emp_row Emp_tab%ROWTYPE; /* declare a record matching a row in the Emp_tab table*/










Any idea how to implement this in Teradata


*
Post #10603
Posted 2/20/2008 12:25:48 AM


Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 11/19/2008 6:25:50 AM
Posts: 22, Visits: 61
Both %TYPE and %ROWTYPE are used to define variables in PL/SQL as it is defined within the database. If the datatype or precision of a column changes, the program automically picks up the new definition from the database without having to make any code changes.

The %TYPE and %ROWTYPE constructs provide data independence, reduces maintenance costs, and allows programs to adapt as the database changes to meet new business needs.
**************
%TYPE
**************
%TYPE is used to declare a field with the same type as that of a specified table's column.
Example:
DECLARE
v_EmpName emp.ename%TYPE;
BEGIN
SELECT ename INTO v_EmpName FROM emp WHERE ROWNUM = 1;
DBMS_OUTPUT.PUT_LINE('Name = ' || v_EmpName);
END;
/
*************
%ROWTYPE
*************
%ROWTYPE is used to declare a record with the same types as found in the specified database table, view or cursor.
Examples:

DECLARE
v_emp emp%ROWTYPE;
BEGIN
v_emp.empno := 10;
v_emp.ename := 'XXXXXXX';
END;
/
Teradata should provide some way to do that


*
Post #10639
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 4 ( 4 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 8:10pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.188. 10 queries. Compression Disabled.