Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Associative Arrays - Oracle 9i
On 2005-12-12, Kent Brye <kbrye_at_ncbex.org> wrote:
> It's Monday and I'm having a problem grasping how to do something. Does
> anyone have a vanilla example of how to create, fill, cursor off of an
> associative array?
>
> I'm trying to manipulate some text (varchar2 column) for a report to put in
> some line numbers that would be is used in editing. Like in a legal
> document so you can quickly get to line 43 for example. In any event I was
> going to parse the text into a predetermined length (i.e. 80 char wide) and
> put in line numbers. The associative array would have two columns: line
> number and text string. The stored procedure used for the report would have
> a cursor that would select off of the associative array. The stored proc
> would be used in crystal reports for the final output. I'm more than open
> to other ideas.
First: it is unclear why you would use an associative array. I'd assume that the document has the line numbers from 1 to n without missing line numbers between.
If this is the case, a
type some_type_name as table of varchar2(80)
seems perfect to me.
Second, what is your interface to the function you want: I could imagine, for example
function f (line_from# in pls_integer,
line_to# in pls_integer)...
to make sense.
Third, why wouldn't you store the lines in a table (possibly a global temporary one) and 'traditionally' select off this table?
You need to provide more details in order to be helpful for us (at least for me.)
hth
Rene
-- Rene Nyffenegger http://www.adp-gmbh.ch/Received on Mon Dec 12 2005 - 16:10:08 CST