Welcome to Dream.In.Code
Become an Expert!

Join 150,003 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,350 people online right now. Registration is fast and FREE... Join Now!




PL/SQL

 
Reply to this topicStart new topic

PL/SQL, Create a Varray

cswtsjaij
15 Nov, 2006 - 01:28 PM
Post #1

New D.I.C Head
*

Joined: 30 Jun, 2006
Posts: 24


My Contributions
Hello All,

I need help with the following problem:

Create a VARRAY with a size_limit of 15; initialize the VARRAY to 5 elements starting with 1. Using the DBMS_OUTPUT.PUT_LINE statement:

1. Show output using the collection method COUNT
2. Show output using the collection method FIRST
3. Show output using the collection method NEXT
4. Show output using the collection method LAST
5. Show output using the collection method LIMIT

How would I go about creating this?

THANKS for any replies.
User is offlineProfile CardPM
+Quote Post

Trogdor
RE: PL/SQL
16 Nov, 2006 - 03:33 AM
Post #2

D.I.C Addict
Group Icon

Joined: 6 Oct, 2006
Posts: 549



Thanked: 4 times
Dream Kudos: 125
My Contributions
Why would we do your homework for you?

This post has been edited by Trogdor: 16 Nov, 2006 - 03:35 AM
User is offlineProfile CardPM
+Quote Post

cswtsjaij
RE: PL/SQL
16 Nov, 2006 - 11:20 AM
Post #3

New D.I.C Head
*

Joined: 30 Jun, 2006
Posts: 24


My Contributions
QUOTE(Trogdor @ 16 Nov, 2006 - 05:33 AM) *

Why would we do your homework for you?


Trogdor all I am asking for is how to start this problem not for any to do it all. I will take references to any web sites that will help me to understand what I need to do.
User is offlineProfile CardPM
+Quote Post

kiran9i
RE: PL/SQL
21 Nov, 2006 - 12:23 AM
Post #4

New D.I.C Head
*

Joined: 21 Nov, 2006
Posts: 2


My Contributions
hi
this is kiran here.

for u r varray assignment this example will help u

-------------------------------------------------------------------------------------
Varray---
-----------------------------------------------------------------------------
create or replace procedure varray_test
as
type type_array is varray(5) of varchar2(50);
x type_array ;
cnt number :=0;
begin
x :=type_array();
for i in 1 .. x.limit
loop
cnt :=cnt +1;
x.extend;
dbms_output.put_line(x.count);
if (cnt mod 2 =0) then
x(i) := 'nivas + '||cnt;
end if;
end loop;
dbms_output.put_line(x.count);
for i in 1 .. x.count
loop
dbms_output.put_line(nvl(x(i),'kiran'));
end loop;
end;


now u can try it !!!!
bye
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 08:36PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month