i have written a oracle query in Script Task and assigned it to string variable. This is my query
string oracle_query = "SELECT bank_ID, Branch_ID, Trans_NUM, Trans_DT, convert(Varchar(25),quantity) AS quantity FROM OPENQUERY(orcale_server_name, 'SELECT * "
+ "FROM oracletable" +
" where bank_ID =''" + Dts.Variables["User::bank_ID"].Value.ToString() + "'' AND Trans_DT = ''" + Dts.Variables["User::Trans_DT"].Value.ToString() + "'' AND quantity = " + Dts.Variables["User::quantity"].Value.ToString() + " AND Branch_ID = ''" + Dts.Variables["User::Branch_ID"].Value.ToString() + "'' ')";
the result of this query has been assigned to string variabl which i have declared in my package
Dts.Variables["oraclequery"].Value = oracle_query; .
output of this query is
bank_ID Branch_ID Trans_Num Trans_DT Quantity
12 13 12AS566 2012-01-01 4000
Based on Trans_Num column i need to update one more table.
Instead of script task i can use oledb TranFormation, but while passing Running parameters in Oledb Source, no data is coming.
So the result of script task i have assigned to OracleQuery varibale and passed as source variable in Execute Sql Task and resultset as Full Result Set .
This Execute SQl Task resultset i have passed to for each loop container and inside varibale index i have assigned OracleQuery Varibale.
but still no data is populating
1.First you need to create variables for the column being retrieved from your oracle query
2.Then the variable
oraclequeryshould be of type System.Object3.In the
resultSettab of Execute SQL task assign the result to the variableoraclequery4.Then in the ForEach Loop use
ADO Enumeratorand selectADO Object SourceVariableto oraclequery and click the radio buttonRows in the First TableIn the variable mapping of for each loop, map the columns in the same order as it is being retrieved from the query .
Now you can access these variable inside inside a
DFTplaced in the Foreach loop and then useOLEDB componentto update another table based on theTrans_NumFor more details refer this article and this