On Fri, Jan 10, 2014 at 1:28 AM, Remigiusz Sokolowski < remigiusz.sokolowski@xxxxxxxxxx> wrote: > I am not sure if my answer showed on the list, but the point is to > generate a script while get rid of any unnecessary lines in order to get > clean answer when run it. However after generating this script I would like > to know how many items were generated > > There comes a point where trying to work around the normal operations of sqlplus to get the desired output becomes convoluted and devolves into unintelligible spaghetti code. You may have reached that point. Consider using a scripting language (I prefer Perl) that has built in formatting methods. Perl is quite good at this, as it has the 'format' and related constructs for reporting, as well as printf. Added bonus: if you are using Oracle, you already have Perl with DBI and DBD::Oracle installed. Or consider using PL/SQL, though formatting output in PL/SQL is quite a pain IMO, as well as dealing with limited output locations, unless you just buffer and redirect. Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist Sr Oracle DBA at Pythian Pythian Blog http://www.pythian.com/blog/author/still/ Oracle Blog: http://jkstill.blogspot.com Home Page: http://jaredstill.com