Pass List of
Good Morning,
I need to break up a list of about 45,000 IDs to pass about 5,000 at a time into a query on DB2 via an Expression on a Data Flow Task. The query works when hard coding the values into the query (see A below). I can also pass a single value (05404928)
into the variable and it works as in B. I cannot seem to get a statement where multiple values are passed into the variable as a string (like 05404928,01264567) to work as in C, however. I am not sure if it's the syntax/combination of single/double
quotes or whether this approach is just not possible. Is this possible or am I approaching this problem from completely the wrong way? Thanks kindly for any thoughts.
A)
"select
PRSNAD.PERSON_NUM,
PRSNEUP.ID as MRN,
PERSONP.LAST_NM,
PERSONP.FIRST_NM,
PRSNAD.DATA_UPDATE_TS,
PERSONP.BIRTH_DTTM,
PERSONP.DEATH_DTTM,
PERSONP.RACE_CDE,
PERSONP.ETHNIC_GROUP_CDE,
PERSONP.MARITAL_STATUS_CDE,
PERSONP.RELIGION_CDE,
PRSNAD.STATE_CDE,
PRSNAD.COUNTRY_CDE,
PRSNAD.COUNTY_NM,
PRSNAD.POSTAL_CDE,
PERSONP.GENDER_CDE
from LWRO1P.PERSON PERSONP,
LWRO1P.PRSNID PRSNEUP,
LWRO1P.PRSNAD PRSNAD
where
(PERSONP.NUM = PRSNEUP.PERSON_NUM) and
(PERSONP.NUM = PRSNAD.PERSON_NUM) and
(PRSNEUP.TYPE_CDE = 'MEDREC') and
(PRSNEUP.XEPRUN_ID = 'MRENTR') and
(PRSNAD.DATA_UPDATE_TS = (select max(AD.DATA_UPDATE_TS)
from LWRO1P.PRSNAD AD
group by AD.PERSON_NUM
having AD.PERSON_NUM = PRSNAD.PERSON_NUM)) and
(PRSNEUP.ID in ( '05404928','00340534'))"
B)
"select
PRSNAD.PERSON_NUM,
PRSNEUP.ID as MRN,
PERSONP.LAST_NM,
PERSONP.FIRST_NM,
PRSNAD.DATA_UPDATE_TS,
PERSONP.BIRTH_DTTM,
PERSONP.DEATH_DTTM,
PERSONP.RACE_CDE,
PERSONP.ETHNIC_GROUP_CDE,
PERSONP.MARITAL_STATUS_CDE,
PERSONP.RELIGION_CDE,
PRSNAD.STATE_CDE,
PRSNAD.COUNTRY_CDE,
PRSNAD.COUNTY_NM,
PRSNAD.POSTAL_CDE,
PERSONP.GENDER_CDE
from LWRO1P.PERSON PERSONP,
LWRO1P.PRSNID PRSNEUP,
LWRO1P.PRSNAD PRSNAD
where
(PERSONP.NUM = PRSNEUP.PERSON_NUM) and
(PERSONP.NUM = PRSNAD.PERSON_NUM) and
(PRSNEUP.TYPE_CDE = 'MEDREC') and
(PRSNEUP.XEPRUN_ID = 'MRENTR') and
(PRSNAD.DATA_UPDATE_TS = (select max(AD.DATA_UPDATE_TS)
from LWRO1P.PRSNAD AD
group by AD.PERSON_NUM
having AD.PERSON_NUM = PRSNAD.PERSON_NUM)) and
PRSNEUP.ID in ' " + @[User::IDList] + " ' "
C)
"select
PRSNAD.PERSON_NUM,
PRSNEUP.ID as MRN,
PERSONP.LAST_NM,
PERSONP.FIRST_NM,
PRSNAD.DATA_UPDATE_TS,
PERSONP.BIRTH_DTTM,
PERSONP.DEATH_DTTM,
PERSONP.RACE_CDE,
PERSONP.ETHNIC_GROUP_CDE,
PERSONP.MARITAL_STATUS_CDE,
PERSONP.RELIGION_CDE,
PRSNAD.STATE_CDE,
PRSNAD.COUNTRY_CDE,
PRSNAD.COUNTY_NM,
PRSNAD.POSTAL_CDE,
PERSONP.GENDER_CDE
from LWRO1P.PERSON PERSONP,
LWRO1P.PRSNID PRSNEUP,
LWRO1P.PRSNAD PRSNAD
where
(PERSONP.NUM = PRSNEUP.PERSON_NUM) and
(PERSONP.NUM = PRSNAD.PERSON_NUM) and
(PRSNEUP.TYPE_CDE = 'MEDREC') and
(PRSNEUP.XEPRUN_ID = 'MRENTR') and
(PRSNAD.DATA_UPDATE_TS = (select max(AD.DATA_UPDATE_TS)
from LWRO1P.PRSNAD AD
group by AD.PERSON_NUM
having AD.PERSON_NUM = PRSNAD.PERSON_NUM)) and
(PRSNEUP.ID IN ( '” + @[User::IDList] + “' + ) + "
You can use a >= AND <= condition for that
You can set it up as follows
1. Add an execute sql task with oledb connection manager connecting to sqlserver database and use a query like
SELECT DISTINCT ((ROW_NUMBER() OVER (ORDER BY ID)-1)/5000) + 1 AS Grp,MIN(ID) AS MinID,MAX(ID) AS MaxID
FROM
( VALUES (05404928),(01264567),...)
)t(ID)
replace .. with all your ID values.Choose resultset option as Full resultset and map the resultset to object variable created in SSIS (say @[User::IDList]) by mapping to index 0 in mapping tab
2. Add a ForEach loop with ADO enumerator based on IDList variable. Add two variables inside of type int to get iterative MinID and MaxID values by mapping to indexes 1 and 2
3. Inside loop add your data flow task with Db2 query
4. Add a lookup task and add the sqlserver connection manager as connection. use custom query option and use query as
SELECT ID
FROM
( VALUES (05404928),(01264567),...)
)t(ID)
WHERE ID >= ?
AND ID <= ?
and map the parameters to MinID and MaxID variables
Choose the lookup failure option as Redirect to NoMatch output
5. Take match output from lookup task and link it to further tasks
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Similar Messages
-
Passing list of values as a parameter to repot through form
hi,
i am trying to passing parameters to report through form by
using ADD_PARAMETER_LIST and RUN_PRODUCT .but i am not able to
pass list of values to report.For example if use select state_id
from the list box,it has to give all details of that state
report.how to do this?
please help me.
thanks in adv
rao
nullrao (guest) wrote:
: hi,
: i am trying to passing parameters to report through form by
: using ADD_PARAMETER_LIST and RUN_PRODUCT .but i am not able
to
: pass list of values to report.For example if use select
state_id
: from the list box,it has to give all details of that state
: report.how to do this?
: please help me.
: thanks in adv
: rao
there are at least two path to do that:
1. for each detail item mak a parameter in reports and add it to
paramlist
2. pass only stade_id as parameter and in reports query other
details
hope this helps
null -
Pass list of values to DB adapter from BPEL process
We want to pass a list of values (length of list and values to be passed will be dynamically determined by the input to this invocation)
How do we pass the input as a list of values to a db adapter where the list of values will form a part of input query where clause.
say eg
select date from tablea where columna in (List1,list2,lsit3) etc
ThanksThis will help you
http://soa-howto.blogspot.com/2009/05/how-to-use-sql-query-having-in-clause.html -
How to remove "Records passed" list when printing ALV report
Hi all,
I have developed an ALV report, in which I have used reuse_alv_list_display functional module to print the output. After pressing print button, when I view the output in spool request transaction, an additional list with Number of records passed and "Calculated total records" is displayed. How to remove this additional list.
I am using Get_print_paramaters FM to print.
Thanks,
rajanHi
Suppress the messages of the FM by commenting the exceptions and message statement
Regards
Shiva -
Pass list of structure as input parameter to visual composer iview
Hi
In my application, I need to create an iview which has a table view. Start point has same structure as table columns. Now I deployed this iview and assign to every user core role. Now i am using in in my GP. It is getting a list of structure as input but it is showing only one row in the table.
Anyone has idea about this.
Regards
Saurabh GargHi Saurabh,
How did you do for passing at least one row ?
Can you explain that ?
Thanks a lot
btw, Did you succeed to pass several rows ? -
Pass List MyObject as a parameter with jax ws web service
Hi,
I need to pass a list of strongly typed object as a parameter in my web service which utilizes jax ws.
For some reason I am not able to pass more than one.
For example if do the following in my soap message:
<Objects>
<Object>
<property>myVal</property>
</Object>
<Object>
<property>myVal</property>
</Object>
</Objects>The above will be treated as one object in my java code.
Edited by: kminev on Dec 15, 2009 11:55 AMWIS is not suppported on WLS JAX-WS. You'll need to use other authentication mechanisms such as http basic (which you tried already), or message-level security such as UNT, or SAML.
Regards,
Pyounguk -
SQL Query: How to pass list of values to the IN operator
Hi,
I'm trying to pass a list of values to the WHERE <a> IN <list>
I dont want to use dynamic cursors (REF CURSOR). Is this possible using Oracle SQL?
Please let me know.
My program:
DECLARE
list_of_ids := '10, 20, 30';
SELECT MAX(sal) INTO max_sal FROM employee WHERE emp_id IN (list_of_ids);
END;
Thanks in Advance,
NikoYou do not want to pass a comma separated list. You want to pass a collection. So
CREATE TYPE num_tbl
AS
TABLE OF NUMBER;
DECLARE
l_list_of_ids num_tbl := num_tbl( 10, 20, 30 );
BEGIN
SELECT max(sal)
INTO max_sal
FROM employee
WHERE emp_id IN (SELECT * FROM TABLE( l_list_of_ids ));
END;
/Justin -
Passing list of values to a function
As what type list of values multiple selections, e.g. resulting in (1,2,3), are represented in function parameters?
for example i have lov that results in (1,2,3) and dataset query is select myfunction(:mylov) from dual.
Variable of what type I must declare in function definition?when i hadthe same situation , i used cursor query to resolve .
eg.
select myfunction(cursor(select field1 from table1 where field1=:parameter1)) from dual
In the PL sql function get all thee parameters from the cursor variable and pass into the looping statement for furthur processing -
Passing list of pernr into function module
Hi,
I need to buid one Function module in which if i pass the list of pernr, I should get one structure of appraisal document
I have created import parameter of HRPERNR type but when i loop is through that parameter it is saying it is not table type
please guide me in writing this FMHi,
You can create a parameter table, on tab table like your parameter importing HRPERNR.
Atte,
Romerito Mendes Silva -
Urgent : Passing List or Hashmap to webservices
Hai
I need to pass the Hashmap and List as parameter to an EJB which is published as an webservice.
I tried with passing string as an parameter and succeed with it, but i don't know how to pass the List as an parameter.
Can any one help me to resolve this.
Thanks
T.GopalakrishnanHai I am using SAAJ api to create SOAP message and i need to add java.util.List as an parameter to it.
I am using weblogic 7 and glue -
Passing list collection from page to page
Using wp 8.1 and c#, I need to build a collection on one page1, then use the collection throughout the app for every page including page2, page3, page4, etc.
Can anybody offer advise to consider?
I thank the Lord Jesus for your kind effort and patience with me (Jeremiah 9:23-24 of the Holy Bible).Is this Silverlight or is it windows store app?
It doesn't matter a great deal.
You have three options.
1)
You can add any old object you like to resources and there's an application scoped set of resource.
In windows store apps I think that'd be app.current.resources and in silverlight it's application.current.resources.
You do:
Application.Current.Resources.Add("somekey", yourlist);
and that adds it to your resources.
App.current... for win store app.
To get a reference back to that thing ( note, it's a reference and therefore the same object).
List<t> mylist =Application.Current.Resources["somekey"] as List<t>;
Obviously, that list can instead be some other sort of collection and <t> is the type of the objects in it.
You can see this approach used in one of my WPF samples:
https://gallery.technet.microsoft.com/Dynamic-XAML-Composed-View-e087f3c1
This shares two observable collections in a similar manner.
It proves they are definitely the same object because you can edit a person and see the changes immediately in the corresponding datagrid row.
2)
You could alternatively send the List<t> using Mvvm Light messenger in an object and subscribe to that object type in the "receiving" pages. They would have to be in memory and I think option 1 is your best bet.
3)
You could create the collection in one place - like mainpage eg. Then pass that collection via the constructors of the other pages as you new them up. I don't really like this approach because it introduces a dependency to all those pages which
means testing etc is harder. I don't consider it a professional approach if there's an alternative - but it's an approach plenty of professionals advocate so your mileage may vary.
It's not really any simpler than using resources.
Hope that helps.
Recent Technet articles:
Property List Editing ;
Dynamic XAML -
Pass list of values in an array to the IN statement of SELECT in Oracle 10g
Hi,
This is what I have done so far...
I have loaded the main array array_number_1 using BULK Collect. Within the loop I am filtering the data from this array and writing to another array array_number_2.
I want to use the values from array_number_2 in the SELECT statement.
Eg: SELECT sum(x_amount) charges
FROM x_table
WHERE id IN (array_number_2).
Could you provide a solution to this preferrably with an example.
thanksI'm not entirely following you, Visakh, but I have a SQL Task setup in which I have an expression that makes a call to a db2 database such as the abbreviated set example below. The list of IDs in the IN statement must come from another SQL Server
database. In the past I have gotten the list of IDs, put them in a recordset and then put that in a for loop to iterate and make one call to db2 for each and every ID. The single ID example can literally take days to run for 100,000 IDs.
Therefore, I want to pull the entire set of results back at one time via a single (or at least fewer calls than there are IDs) DB2 call using 'in' instead. Maybe I am overlooking something but I don't quite see how your example will get me where
I want to go.
Set Example
SELECT
A,
B
FROM
Table 1,
Table 2,
WHERE
Joins
AND PRSNEUP.ID in ( This is where I want a list of IDs )
Single ID Example
SELECT A,
B
FROM
Table 1, Table 2,
WHERE
Joins AND PRSNEUP.ID = ( VariableContainingASingleID -
How to pass list of values to REF CURSOR?
Hi there,
I have a package for ref cursor return as following:
<pre>
create or replace package p_mypkg as
type t_ref_cur is REF CURSOR;
function f_t_refcur (strsql varchar2) return t_ref_cur;
end;
create or replace package body p_mypkg as
function f_t_refcur(strsql varchar2) return t_ref_cur as
cur t_ref_cur;
sql_stmt varchar2(1000);
begin
sql_stmt:='select object_name,object_type from user_objects where object_type in (:j)';
open cur for sql_stmt using strsql;
return cur;
end;
end;
var results refcursor
begin
:results:=p_mypkg.f_t_refcur('TABLE');
end;
print results
var results refcursor
begin
:results:=p_mypkg.f_t_refcur('INDEX');
end;
print results
I got the result sets using just one value.
But I got nothing when use two values as input.
Any idea?
var results refcursor
begin
:results:=p_mypkg.f_t_refcur('''TABLE'',''INDEX''');
end;
print results
SQL>
no rows selected
Thanks,
SZYou can also use ...from table(... :
create or replace type numbertype
as object
(nr number(20,10) )
create or replace type number_table
as table of numbertype
create or replace procedure tableselect
( p_numbers in number_table
, p_ref_result out sys_refcursor)
is
begin
open p_ref_result for
select *
from employees , (select /*+ cardinality(tab 10) */ tab.nr from table(p_numbers) tab) tbnrs
where id = tbnrs.nr;
end;
/ -
Passing dynamic list / array of values to Droplet
I want to know what's the best way to pass list of values as array or list to a droplet.
Any examples here?u can refer to the following droplet , it uses both list and array
<droplet bean="/atg/commerce/pricing/PriceEachItem">
<param name="items" value="param:product.childSKUs">
<!-- the product param is already defined in this scope so we do not need to set it -->
<oparam name="output">
<!-- Now iterate over each of the CommerceItems to display the prices -->
<droplet bean="/atg/dynamo/droplet/ForEach">
<param name="array" value="param:element">
<param name="elementName" value="pricedItem">
<oparam name="output">
<valueof param="pricedItem.auxiliaryData.catalogRef.displayName"></valueof> -
<!-- Toggle a different display depending if the item is on sale or not -->
<droplet bean="Switch">
<param name="value" value="param:pricedItem.priceInfo.onSale">
<oparam name="false">
<valueof param="pricedItem.priceInfo.amount" currency>no price</valueof>
</oparam>
<oparam name="true">
List price for <valueof param="pricedItem.priceInfo.listPrice" currency>no price</valueof>
on sale for <valueof param="pricedItem.priceInfo.salePrice" currency></valueof>!
</oparam>
</droplet><BR>
</oparam>
</droplet>
</oparam>
</droplet> -
Passing a list as a parameter to a function
Hi,
I am relatively new to PL/SQL, but am used to passing lists to functions in other languages. In my PL/SQL function, currently I assign a SELECT to a cursor, and in the WHERE clause for the select, I have something hardcoded like
WHERE field_name = ('apple', 'bat', 'cat').
I would like to replace it by something like
WHERE field_name = list_name
where list_name is passed as a parameter to the function that I am defining. The reason I want to do this is because my list_name can have many more than three things in the future.
Does PL/SQL support an easy way to do this? I have asked around with no success, but it seems to me that a language like PL/SQL ought to have something to support it, since just about every modern language does.
Thanks,
Regards,
SriniThe trickiest part of the asktom solution is ensuring the cardinality hint is used to help the optimizer understand that the in-list you are building likely contains only a handful of values instead of it 1 whole block worth assumption.
The default assumption without the cardnility hint will ensure that an index on the column that is used for the IN clause will never be used, resulting in horrible performance.
I think 10g fixes this, and does some dynamic sampling of the collections returned through that approach. I am not quite 100% sure about that, but I think that is the case.
Maybe you are looking for
-
To support certficate based client authentication using 2-way SSL from a standalone java application which uses JNDI and JSSE1.0.2 to connect to an SSL enabled LDAP Server how do we configure the certmap.conf?Is there any additional setup required at
-
Creation of JCO Destinations for web dynpro
Hi all, I read quite a lot of post concerning the subject but unfortunately I did not found a solution to my problem. My goal is to create JCO Destinations to make my web dynpro to connect to an R3 system. In order to realise this I followed these st
-
Verizon installed a month ago and my land line phone won't work
Had Verizon installed in December. My old internet/phone/cable provider raised their rates so I shopped around and went with Verizon. Soon after, my cordless phone would stop working. No dial tone and if someone tried to phone me, they would get a bu
-
Xhost + command not found in solaris
hi i am installing oracle 10g rel 2 on solaris 5.10. i hv set all environment.. and then i entering xhost + command it gives an error. kindly acknowledge. -Yuvraj
-
Unable to read the freq and amplitude
if you could look at the prog.s attached and if you can explain why i am unable to read the data output from "scalled data vs seconds" into tone measurments. it must have something to do with the conversion from the cluster of 3 elements to the DBL w