Can anyone please give me some thoughts on this
I have a scenario where I need to create multiple extract files based on a column values using bteq script and in unx environment.
You can try with two bteq scripts. Run 1st betq script and get the unique IDs exported to a file. With a shell script, read the exported file and pass value and call 2nd bteq script which export the data with a WHERE clause as the passed value.