I have table with a column called State. My requirement is to read data from the table and write it into multiple files based on State name. I'm using Informatica PowerCenter as ETL tool
Create a mapping as below:
Source --> SQ (sort data state name)--> Expression --> Transaction Control --> Target
Expression: Create a variable port to store previous value of state and a output port flag.
flag = IIF(state = var_state,0,1)
var_state = state
In Transaction Control Transformation, use TC_COMMIT_BEFORE when Flag = 1
Add Filename port to Target and map state name as filename.
You can also do this using post shell command:
Output file --> Name of output file of Informatica.
$2 --> assume 2nd field is the statement. Replace it as per your file
awk -F\| '{print>$2}' outputfile
来源:https://stackoverflow.com/questions/50087907/informatica-write-data-into-multiple-files-based-on-state-name