PC Review


Reply
Thread Tools Rate Thread

Oracle RowType Issue

 
 
FB
Guest
Posts: n/a
 
      20th Jan 2010
Hi All,
Im new to Oracle.
I have a Rowtype and i want to Loop through that Rowtype without
mentioning the Column name.

My code as below :


declare
empRowType Emp%ROWTYPE;
begin
SELECT * INTO empRowType FROM Emp
WHERE Emp_id = 101 ;


for x in ( select column_name from user_tab_columns where
table_name = 'Emp')
loop
i:=i+1;
y:= x.column_name;
z:= 'empRowType.'|| x.column_name;
dbms_output.put_line (z);
end loop;
end


Steps :


1) First Im declaring a RowType of Employee table.
2) Assigning value to RowType by making a select statement.
3) I want to get all the column name value printed so im selecting
the
column names of the table by using USER_TAB_COLUMNS table and running
a for loop.
4) Im concatenating RowTypeName.Column name (ex: z:= 'empRowType.'||
x.column_name
5) Print the Value


I get a O/P as String as :


empRowType.Emp_ID
empRowType.Emp_Name
empRowType.Emp_Department


but i want the O/P as


"101"
"John Peter"
"Marketing Department"


Pls someone help. This is a sample i have created to put in this
website. I cannot use RowType column to meet the requirement.


Thanks in advance,


FB

 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      24th Jan 2010


"FB" <(E-Mail Removed)> wrote in message
news:2bb33eb5-c605-429a-a679-(E-Mail Removed)...
> Hi All,
> Im new to Oracle.
> I have a Rowtype and i want to Loop through that Rowtype without
> mentioning the Column name.


I would try an Oracle forum to ask Oracle questions. It is not that you
won't necessarily get the answer here, but it is is an ADO.NET forum. Oracle
TechNet should have the forums needed.

--
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
| Think outside the box! |
************************************************

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle error occurred, but error message could not be retrieved from Oracle Gerard Lai Microsoft Dot NET Framework 5 19th Dec 2012 10:28 AM
How to trap a rowtype returning parameter from ORACLE. Ghislain Tanguay Microsoft ADO .NET 0 1st Oct 2004 03:56 PM
does oracle 8i or oracle 9i supports windows xp home edition sunny Windows XP General 1 22nd Dec 2003 05:11 PM
How to connect oracle 8i when oracle 8i and oracle 9i installed in one system Prasad Microsoft ADO .NET 0 1st Dec 2003 11:23 AM
Re: Passing Oracle structures to an oracle store proc Bob Beauchemin Microsoft ADO .NET 0 11th Jul 2003 07:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:19 PM.