473,665 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying records using %ROWTYPE

26 New Member
Hi Experts,

I want to display all the elements of a %ROWTYPE type.How can i achieve that.

I have written one sample code.

DECLARE
TYPE dept_info IS record dept%ROWTYPE;
temp_dept_info dept_info;
BEGIN
SELECT *
BULK COLLECT
INTO temp_dept_info
FROM DEPT;
FOR i IN 1 .. temp_dept_info. LAST LOOP
DBMS_OUTPUT.PUT _LINE(temp_dept _info(i));
END LOOP;
END;

But it is showing error.

Here i am trying to display values of each column of dept Table.

Please guide me how to do this?
Waiting for your quick response.

Thanks,
Dilip
Jun 15 '07 #1
2 23453
debasisdas
8,127 Recognized Expert Expert
try this sample code
-------------------------------------
Expand|Select|Wrap|Line Numbers
  1. declare
  2. type tt is table of emp%rowtype;
  3. aa tt;
  4. begin
  5. select * bulk collect into aa from emp;
  6. for i in aa.first .. aa.last loop
  7. dbms_output.put_line (aa(i).ename||'  '||aa(i).sal);
  8. end loop;
  9. end;
  10.  
Jun 15 '07 #2
dilippanda
26 New Member
Hi,

Thanks for the reply.

I am trying to fetch each element using your suggestion with out knowing the column names to make it dynamic.

I have written one code for this.

DECLARE
TYPE dept_info IS TABLE OF dept%ROWTYPE;
temp_dept_info dept_info;
TYPE tab_objects IS TABLE OF VARCHAR2(50);
temp_objects tab_objects;
BEGIN
SELECT column_name
BULK COLLECT
INTO temp_objects
FROM user_tab_column s
WHERE table_name='DEP T';

SELECT *
BULK COLLECT
INTO temp_dept_info
FROM DEPT;

FOR i IN 1 .. temp_dept_info. LAST LOOP
DBMS_OUTPUT.PUT _LINE(temp_dept _info(i).temp_o bjects(1)||temp _dept_info(i).t emp_objects(2)| |temp_dept_info (i).temp_object s(3));
END LOOP;

END;

But it is throwing me the error:
ORA-06550: line 25, column 44:
PLS-00302: component 'TEMP_OBJECTS' must be declared
ORA-06550: line 25, column 5:
PL/SQL: Statement ignored

Please help me.

Thanks,
Dilip

try this sample code
-------------------------------------
Expand|Select|Wrap|Line Numbers
  1. declare
  2. type tt is table of emp%rowtype;
  3. aa tt;
  4. begin
  5. select * bulk collect into aa from emp;
  6. for i in aa.first .. aa.last loop
  7. dbms_output.put_line (aa(i).ename||'  '||aa(i).sal);
  8. end loop;
  9. end;
  10.  
Jun 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4072
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form the user can change the date, which will force a requery in the subform to bring up records from the date selected. My question is this... The query in the subform is a very simple one, with only three fields being returned. In the interest of...
3
4655
by: Lyn | last post by:
I need some guidance for a technique that will allow me to accomplish the following... I have a table in which each record contains a photograph. I would like to display in a form a thumbnail size version of each photograph horizontally across the form, then have the photgraphs "word wrap" (picture wrap ?) at the right end of the form onto the next "line" of photographs. Does anyone know how this can be done? Obviously, displaying...
2
2949
by: VM | last post by:
When I display data to a Windows datagrid I usually fill the underlying table (in another class) and then, once it contains all the data, I attach it to the grid. But there are some processes that involve large amounts of data so the user won't be able to see anything in the grid until after the table's already filled up (usually 40-60 secs with these large processes). Is it possible (without changing the process of filling the table...
14
5795
by: Karl O. Pinc | last post by:
Hi, Thought perhaps some other eyes than mine can tell if I'm doing something wrong here or if there's a bug somewhere. I've never passed a ROWTYPE varaible to a function but I don't see where the problem is. I keep getting errors like (the first is my debug output): NOTICE: last cycle is: 11 WARNING: Error occurred while executing PL/pgSQL function
3
2214
by: Richard Carpenter | last post by:
I understand how to use a dropdown list control to display the associated description value for a foreign key in a parent rather than the key itself, but I don't like having to disable the control when I want to prevent editing (simply displaying in the display template of a datalist or detailview control, for example). I've not been able to find a way to edit the disabled color of the dropdown list, so it appears very washed out - just...
10
3250
by: minapatel | last post by:
Hi, I am trying to purge cases using an sql cursor:- cursor all_cases is cursor all_cases is select c.id00_warehouse, c.id00_case_nbr, c.id00_status_flag, c.id00_dlm from phpick00 a, chcart00 b, idcase00 c where a.ph00_shipto = 'Telford'
1
1392
by: sushant2009 | last post by:
Hi , I want to display empty databae table(actually table contains lot of records) to datagrid using dataset and dataadpter. After displaying i will fill new records in datagrid and i will save it in above thing i want to save new records using datagrid,dataset and dataadpter withought displaying previous ones Some one will tell me please how to do this
0
1457
by: John Kirkpatrick | last post by:
Hi all, I am having difficulty displaying records on a frontend MS Access 2000 form using a MySQL backend. The following code works well with the Jet database engine but doesn't work properly using the MySQL backend database. All records are displayed on the form using the Jet, but only one record appears using MySQL. Perhaps it just needs some tweaking to work with MySQL. Any advice would be great. Thanks Function HelpDesc(HelpFrm As...
5
1943
by: sejal17 | last post by:
hello everyone, I have a problem with displaying records between two dates.Below is my designing page: start date: combobox of month(smonth) & combobox of year(syear) end date : combobox of month(emonth) & combobox of year(eyear) I want the records between this month and year.i have written the below query for that: suppose, smonth=01,emonth=08,syear=2000,eyear=2005
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.