Home » SQL & PL/SQL » SQL & PL/SQL » Help required in returning a cursor of varray
Help required in returning a cursor of varray [message #251119] Thu, 12 July 2007 07:29 Go to next message
suman_john
Messages: 1
Registered: July 2007
Junior Member
I require some code to be written in plsql stored procedure/function, which will help us return a ref cursor with following attributes

v_user_id Varchar2(Cool
v_units type table or varray of varchar2(Cool

I have been able to get all this information stored in a table and then return a ref cursor by selecting * from this table.

But this is not a good design as we need to create a temporary table.

We are currently working on populating a PLSQL collection type table which is a table of object with the same definition as the attributes required to be passed. The problem is coming when I am printing the value from this table.I get ORA-06533: Subscript beyond count. The code snippet for the same is attached.






Re: Help required in returning a cursor of varray [message #251128 is a reply to message #251119] Thu, 12 July 2007 07:42 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read and follow How to format your posts and How to get a quick answer to your question: TIPS AND TRICKS
Make sure that lines of code do not exceed 80 or 100 characters when you format.
Please always post your Oracle version (4 decimals).

Who is Neeraj Kumar?

Regards
Michel
Re: Help required in returning a cursor of varray [message #251328 is a reply to message #251128] Fri, 13 July 2007 00:01 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Michel Cadot wrote on Thu, 12 July 2007 14:42
Make sure that lines of code do not exceed 80 or 100 characters when you format.


Do not exceed 80 or 100? According to my boolean logic, that's 100
Wink
Re: Help required in returning a cursor of varray [message #251568 is a reply to message #251119] Sat, 14 July 2007 17:57 Go to previous message
William Robertson
Messages: 1640
Registered: August 2003
Location: London, UK
Senior Member
I didn't really follow all the code you posted, but you get the "subscript beyond count" when you refer to an element of an array beyond the last element in it, for example:

SQL> DECLARE
  2      t integer_tt := integer_tt(2,5,8);
  3  BEGIN
  4      DBMS_OUTPUT.PUT_LINE( t(4) );
  5  END;
  6  /
DECLARE
*
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at line 4
Previous Topic: I am an arrogant SOB - string compare
Next Topic: counting number of records (merged)
Goto Forum:
  


Current Time: Sun Dec 04 21:04:01 CST 2016

Total time taken to generate the page: 0.19213 seconds