Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Arrays

Re: PL/SQL Arrays

From: John Russell <netnews8_at_johnrussell.mailshell.com>
Date: Sun, 23 Nov 2003 03:59:47 GMT
Message-ID: <u4b0svsjo43n3g4u9mumbbhjuli0cn5299@4ax.com>


>>>I'm not sure I like this solution since anybody could screw with that
>>>variable and change the default behavior of that procedure in their
>>>session. However, that might actually be desirable in some situations.
>>
>>
>> I ran into the same problem, with the same solution. To avoid
>> problems from other code changing the variable, you could declare
>> empty_numarray as a constant within the package.
>
>I don't see how this will work. When you try to make it a constant,
>it's going to require an initialization. That puts us right back to the
>original problem as far as I can see. Namely, how do you write a value
>declaration for an index by array?

I was going from memory, didn't have the source I used. I believe what I actually did was to make a packaged function that returned an uninitialized nested table, and called that in the initialization clause, either for a constant nested table in the package, or in a DEFAULT clause on a parameter.

The situation I had was a web form containing several checkboxes, all with the same name. The PL/SQL procedure that processes the results from this form gets a nested table with an arbitrary number of VARCHAR2s. No problem if the user selected 1 or more checkboxes. But if they didn't select any, the procedure doesn't receive anything for that parameter and will throw an uncatchable exception. Unless there's a DEFAULT clause on the parameter, and that's where a packaged function returning an uninitialized nested table comes in.

John

--
Photo gallery: http://www.pbase.com/john_russell/
Received on Sat Nov 22 2003 - 21:59:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US