473,411 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Difference between PL/SQL table and Record Type

Hi,

I am new to the concept of PL/SQL Collection.
Please give me an idea/Link from which i can easily understand the difference between PL/SQL table and Record Type.

Thanks in Advance.
Dilip
Jan 17 '08 #1
3 20716
amitpatel66
2,367 Expert 2GB
Hi Dilip1983,

Welcome to TSDN!!

Please mske sure you follow POSTING GUIDELINES when ever you post in this forum

Thanks
MODERATOR
Jan 17 '08 #2
amitpatel66
2,367 Expert 2GB
Hi,

I am new to the concept of PL/SQL Collection.
Please give me an idea/Link from which i can easily understand the difference between PL/SQL table and Record Type.

Thanks in Advance.
Dilip
Check for Collections
Jan 17 '08 #3
Hi,

I am new to the concept of PL/SQL Collection.
Please give me an idea/Link from which i can easily understand the difference between PL/SQL table and Record Type.

Thanks in Advance.
Dilip
declare
type rec is record
(v_ename emp.ename%type,
v_empno emp.empno%type,
v_job emp.job%type,
v_sal emp.sal%type,
v_deptno emp.deptno%type,
v_mgr emp.mgr%type );
rec1 rec;
begin
select ename,empno,job,sal,deptno,mgr into rec1 from emp
where empno=(select empno from emp where ename='&ename');
dbms_output.put_line('employee name is:->'|| rec1.v_ename ||
'no is :- '||rec1.v_empno || ' ' || ' having designatio:-' ||
rec1.v_job || 'with salary' || rec1.V_sal || 'and department
no is:- ' || rec1.V_deptno);
if rec1.V_ename='KING' then
dbms_output.put_line('for presedent manager ' || rec1.V_mgr ||
' is null');
end if;
end;
//


DECLARE
TYPE BIN_TAB IS TABLE OF EMP%ROWTYPE
INDEX BY BINARY_INTEGER;
BIN_TAB1 BIN_TAB;
BEGIN
FOR I IN 1..1 LOOP
SELECT * INTO BIN_TAB1(I) FROM EMP WHERE EMPNO = &D;
END LOOP;
FOR I IN 1..1 LOOP
DBMS_OUTPUT.PUT_LINE(BIN_TAB1(I). DEPTNO ||BIN_TAB1(I).ENAME||BIN_TAB1(I).JOB
||BIN_TAB1(I).SAL ||BIN_TAB1(I).MGR);
DBMS_OUTPUT.PUT_LINE(BIN_TAB1(1).ENAME);
END LOOP;
END;
//
Feb 8 '08 #4

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

Similar topics

7
by: - | last post by:
in oracle there is a '%TYPE' to reference the data type of another column. is there an equivalent in mysql? thank you.
3
by: hazz | last post by:
if i have a table record called Rule 1 with 1. table name 2. table column name 3. operator (>,< =) 4. value (0 to n) 5. score how could I create code to create a rule automatically so...
3
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent...
0
by: polocar | last post by:
Hi, I have noticed a strange behaviour of CurrencyManager objects in C# (I use Visual Studio 2005 Professional Edition). Suppose that you have a SQL Server database with 2 tables called "Cities"...
2
by: syntego | last post by:
Is it possible to create a Function Template in UDB 8.2 with a TABLE return type? I would like to have a function federated that has a table return type. When I try: CREATE FUNCTION...
2
by: Michael Bray | last post by:
With the recent release of EF I've decided to dig into it a bit more than I did before... the question I'm specifically interested in, but haven't been able to find a resource to answer it is......
4
by: Yesurbius | last post by:
Access 2003 - latest patches. Windows XP Problem: Table 1 is linked to Table2 by two fields. A Query is made to include all records from Table1 and only those from Table2 where the values...
1
by: 55555 | last post by:
what is difference between variable type and object type??
4
by: jbrumbau | last post by:
Hello, I have a function that goes through each field in a form and checks if it was changed between itself and the existing recordset. It is used to track changes done in any record when the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.