Solved

Define ROWTYPE in Oracle

Posted on 2007-11-19
4
1,979 Views
Last Modified: 2010-04-21
In defining a REF CURSOR, I defined an entire Row as the ROWTYPE.  But I got an error message when I chose only three of the fields.  However, when I chose to retrieve the entire row it compiled just fine.  I want to know a way to define a new ROWTYPE that would enable retrieving only the specified rows.  Any help??

Thanks,

SunDevil
0
Comment
Question by:SunDevilProgrammer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 20317723
can you paste you code please.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 20317865
rowtype means "this type is a copy of the entire row"

you can define records that correspond to a subset of the columns in a row, but a "row type" is by-definition an entire row.
0
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 50 total points
ID: 20317946
try creating a record as shown below :

create type testing_record is  record
( r_empid emp.empid%type,
  r_empname emp.empname%type );

rec_var testing;

while fetching data you can use rec_var in the select/fetch statement.

Refer to the url below for more info on records :

http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/collections.htm#i20479

Thanks
0
 

Author Closing Comment

by:SunDevilProgrammer
ID: 31410059
Thanks, nav kum v!  Actually just this morning I figured it out, but you still deserve credit for this.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question