After what was showed in the “Part 1” now I will show how to loop thru a text file one line at once until the last.
At true, it is a simple trick, let start….
- Follow all information from “Part 1”
- Create a new variable (I named it as vLineNumber) with the following code at refresh tab (Oracle code):
select #vLineNumber + 1 from dual
Choose any Oracle schema for execute the query. It will look like:
- Go back to the variable created at “Part 1” and change the attribute SNP$CRFILE_FIRST_ROW to:
The code will looks like:
- Now is just create a package and put the variables together like
- Drag and drop the vLineNumber in set mode setting the value to 0 (zero) – First Step
- Drag and drop the variable vLineNumber once again in refreshing mode
- Drag and drop vReadFile in refreshing mode
- Drag and drop any ODI object that uses the variable like Procedure, Interface, etc.
- The loop will end with an error when the file reachs the end, then put a KO line from the vReadFile step like: