where do you want the lender number filtering to be applied?
before or after row numbers and counts are generated?
Main Topics
Browse All TopicsI have a stored proc with a variable that I need to set based on what parameters are passed, and then include that variable in my 'where' clause. After I set the variable, my cursor does not see what is in the variable called SQLText?
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.
first,
the type MUST be declared separately.
you "can" put str2tbl in your package if you want, but it is a generic utility, I recommend leaving it standalone, or putting it into a package where you have other similar utilities.
however, if you "really" want to put the str2tbl function in your package you simply have to include the full function in the package body (without "create or replace") and then declare it in the package.
if you don't want use str2tbl, you don't have to. But you must find some other way to turn a delimited string into a set.
You could, alternately create a temp table (which, of course, wouldn't be in your package either)
and then parse the string yourself and insert each element into the temp table
then change the IN clause from
WHERE lender_number IN
(SELECT TO_NUMBER(COLUMN_VALUE)
FROM table(str2tbl(lender_list)
to
WHERE lender_number IN
(SELECT your_column from your_temp_table )
Okay, I actually like your idea using a temp table instead, but I need help declaring a temp table in my package. I already had a function to parse the lender list, so now I need to know how to create the temp table and fill it with values.
I am going to increase the points for this question. You deserve it LOL!
you don't create the temp table in the package
it's a separately created entity. It might be "temporary" but it's still a real table.
CREATE GLOBAL TEMPORARY TABLE your_temp_table(
your_column number
)
ON COMMIT PRESERVE ROWS;
in your function where you parse the list...
as you iterate through each value you must have some variable where you put them
simply put that variable into an insert statement
insert into your_temp_table (your_column) values (your_variable);
Remember to purge your temp table afterward (or change it to delete on commit, or simply end your session)
I suggest going with the str2tbl option. not only does it make your code smaller and easier to maintain but it's a general purpose solution, you can use it again and again for any string splitting.
you "could" even use it populate your temp table (this is for illustration only, DON'T do this)
insert into your_temp_table (your_column)
(select column_value from table(str2tbl(lender_list)
that would parse and populate the table all at once.
it would be silly (and inefficient) to do so in this instance though because you don't want to parse and the query the data twice.
Business Accounts
Answer for Membership
by: johnsonePosted on 2009-02-02 at 12:50:48ID: 23531185
I believe this should do what you are looking for. You can pass the parameter into the cursor.
Select allOpen in new window