PL/SQL

Create a Varray

Page 1 of 1

3 Replies - 2256 Views - Last Post: 21 November 2006 - 01:23 AM Rate Topic: -----

#1 cswtsjaij  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 30-June 06

PL/SQL

Posted 15 November 2006 - 02:28 PM

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.

Is This A Good Question/Topic? 0
  • +

Replies To: PL/SQL

#2 Trogdor  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 627
  • Joined: 06-October 06

Re: PL/SQL

Posted 16 November 2006 - 04:33 AM

Why would we do your homework for you?

This post has been edited by Trogdor: 16 November 2006 - 04:35 AM

Was This Post Helpful? 0
  • +
  • -

#3 cswtsjaij  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 30-June 06

Re: PL/SQL

Posted 16 November 2006 - 12:20 PM

View PostTrogdor, on 16 Nov, 2006 - 05:33 AM, said:

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.
Was This Post Helpful? 0
  • +
  • -

#4 kiran9i  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-November 06

Re: PL/SQL

Posted 21 November 2006 - 01:23 AM

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1