| RAJNISH |
Posted: Jul 18, 2008 08:28:45 AM |
Total Post: 92
Joined: Jan, 2007
|
Hi All,
What is Nested table and Varray.?
some body send me some example of Nested table and varray.
Thanks,
Rajnish. |
|
|
shake |
| Posted: Jul 21, 2008 06:49:53 AM | |
|
Total Post: 85
Joined: Jun, 2008
|
Collection is an ordered group of elements, all of the same type, available in PL/SQL. It is of 3 types.
* Associative arrays or index-by tables
* Nested tables
* Varrays (Variable-size arrays)
Nested tables represent sets of values. You can think of them as
one-dimensional arrays with no upper bound. You can have multi-dimensional
arrays by creating nested tables whose elements are also nested tables.
Varrays allow you to reference individual elements for
array operations, or manipulate the collection as a whole. A varray has a maximum size, which you specify in its type definition. Its index has a
fixed lower bound of 1 and an extensible upper bound.
For more info, go through any site with examples. www.java2s.com contains many examples.
|
|
|
|
|
RAJNISH |
| Posted: Jul 22, 2008 01:01:53 AM | |
|
Total Post: 92
Joined: Jan, 2007
|
Hi Shake.
Thank u so much for reply.
but can you do favor on me can u send me some example code.
u mentioned one link but that is for Java you some link of Oracle?
--Rajnish
|
|
|
|
|
puri |
| Posted: Jul 22, 2008 04:51:22 AM | |
|
Total Post: 18
Joined: Jul, 2008
|
hi rajnish
check this. i think this will help u
A NESTED TABLE CAN BE THOUGHT OF AS A DATABASE TABLE WITH TWO COLUMNS KEY AND VALUE. NESTED TABLES MUST BE CREATED WITH SEQUENTIAL KEYS, AND THE KEYS CANNOT BE NEGATIVE. NESTED TABLES CAN BE STORED IN THE DATABASE WHILE INDEX-BY TABLES CANNOT. THE MAXIMUM NUMBER OF ROWS IN A NESTED TABLE IS 2 GIGABYTES, WHICH IS ALSO THE MAXIMUM KEY VALUE.
SYNATX:
TYPE table_name IS TABLE OF table_type[NOT NULL];
WHERE table_name is the name of the new type, and
table_type is the type of each element in the nested table. table_type can be a user-defined object type or it can be an expression using %type, but it cannot be boolean, nchar, nclob, nvarchar2, or ref cursor.
example:
declare
type numberstab is table of number;
v_tab1 numberstab:=numberstab(-1);
v_primes numberstab:=numberstab(1,2,3,5,7);
v_tab2 numberstab:=numberstab();
begin
v_tab1(1):=12345;
for v_count in 1..5 loop
dbms_output.put_line(v_primes(v_count)||' ');
end loop;
dbms_output.new_line;
end;
/
varray:
a varray is a datatype very similar to an array in c or java. it is accessed similar to a nested table however it has a fixed upper bound on its size.
syntax:
type type_name is {varray| varying array}
(max_size) of element_type[not null];
example:
DECLARE
TYPE NUMBERS IS VARRAY(20) OF NUMBER(3);
V_NULLLIST NUMBERS;
V_LIST1 NUMBERS:=NUMBERS(1,2);
V_LIST2 NUMBERS:=NUMBERS(NULL);
BEGIN
IF V_NULLLIST IS NULL THEN
DBMS_OUTPUT.PUT_LINE('V_NULLLIST IS NULL');
END IF;
IF V_LIST2(1) IS NULL THEN
DBMS_OUTPUT.PUT_LINE('V_LIST2(1) IS NULL');
END IF;
END;
/
let me know whether this is the one you want.
with ragards
kalyani
|
|
|
|
|
shake |
| Posted: Jul 23, 2008 12:36:38 AM | |
|
Total Post: 85
Joined: Jun, 2008
|
Kalyani has given good explanation with examples. I guess this could surely answer your doubts. But here is the absolute path (link) for Collection examples in java2s.
http://www.java2s.com/Tutorial/Oracle/0520__Collections/Catalog0520__Collections.htm
|
|
|
|
|
RAJNISH |
| Posted: Jul 23, 2008 01:33:26 AM | |
|
Total Post: 92
Joined: Jan, 2007
|
Hi Kalyani,
yes u r right dear these is the one i am looking for.
thank u so much.if u have some more information about these kindly send me my email address.i.e.chauhanrajnish@gmail.com
please mention your email address bcz i have some doubt so i can ask mmy query by mail.
Regards,
Rajnish.
|
|
|
|
|
puri |
| Posted: Jul 23, 2008 02:48:45 AM | |
|
Total Post: 18
Joined: Jul, 2008
|
hi rajnish,
iam happy to see ur reply
u can post your doubts here in this.. so that others can also see them
tahnks®ards
kalyani
|
|
|
|
|
RAJNISH |
| Posted: Jul 23, 2008 05:07:47 AM | |
|
Total Post: 92
Joined: Jan, 2007
|
Hi Kalyani,
can u explain me SDLC concept of oracle?
Thanks,
Rajnish
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |