I only have the 10, and they a form fields on a web page. I have no way to pass them in as an array... at least not to my knowledge.
I'm implementing your code now and will let you know how it goes.
Thanks!
Main Topics
Browse All TopicsIn my package body, I've defined the function to receive the following variables:
...
orgncode1 IN VARCHAR2 DEFAULT NULL,
orgncode2 IN VARCHAR2 DEFAULT NULL,
orgncode3 IN VARCHAR2 DEFAULT NULL,
orgncode4 IN VARCHAR2 DEFAULT NULL,
orgncode5 IN VARCHAR2 DEFAULT NULL,
orgncode6 IN VARCHAR2 DEFAULT NULL,
orgncode7 IN VARCHAR2 DEFAULT NULL,
orgncode8 IN VARCHAR2 DEFAULT NULL,
orgncode9 IN VARCHAR2 DEFAULT NULL,
orgncode10 IN VARCHAR2 DEFAULT NULL,
...
These variables are coming from a web form, and the user might enter the same code on multiple lines. They might also enter different codes on each line. I need to somehow find only the unique values. So, let's say the variables are set as follows:
orgncode1 := '(12345) Some Words';
orgncode3 := '(23456) Other Words';
orgncode5 := '(34567) More Words';
orgncode6 := '(23456) Other Words';
orgncode8 := '(12345) Some Words';
There are only 3 unique (distinct) values there.
I need to somehow extract only the unique values, and then do another lookup using the number in that string. I can handle the lookup, just need help with the unique values.
Oracle Version = 10.2.0.3.0.
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks for giving it a go billprew!
@Andytw:
I'm trying to add this to an existing package. Here's what I've done:
In the pacakge specification, I added (size of 6 is fine):
type varcharTab is table of VARCHAR2(6);
AND:
PROCEDURE addIfUnique(pTable IN OUT varcharTab, pNewValue VARCHAR2);
In the package body specification I've added the code below. I've clipped out irrelevant code.
However, it's failing on the call to the procedure with the error "PLS-00306: wrong number or types of arguments in call to 'ADDIFUNIQUE'"
I'm guessing I'm wiring it up incorrectly....
L00M: The reason you get that error is that because when you declare the TYPE varcharTab, it is local to that PL/SQL block in which it's declared. PL/SQL isn't clever enough to know that when you call the function and pass in what is effectively the same data-type (e.g. TABLE OF VARCHAR(6) that they're the same. Hence you get the PLS-00306 error.
The solution is to declare "varcharTab" in the scope of the package, like this:
Ahhh, the classic scope issue.
Ok, I moved it to the package scope just as you show above. But now I'm not sure where to put:
uniqueVals varcharTab := varcharTab();
I still have the type definition in the package spec. And I 've added it to the procedure scope, and I get the error:
PLS-00371: at most one declaration for 'VARCHARTAB' is permitted
If I add it at the global scope, I get the same error, and if I remove that line, I get the expected:
PLS-00201: identifier 'UNIQUEVALS' must be declared
Thanks for your help.
Business Accounts
Answer for Membership
by: AndytwPosted on 2009-10-19 at 10:18:36ID: 25607064
How many "orgncodeN" parameters do you have? I'd recommend that you pass these values to your package procedure/function as a array (PL/SQL collection type).
However, for your example the following PL/SQL code should do the job:
Select allOpen in new window