Just taking a quick look at it, the SQL part shouldn't be a problem: select SUBSTR(REPLACE( 'A100bb3733312229','b','0'),4,9) from dual Obviously, replace the b's with spaces ... and the first string passed to the replace function with your 16 character field. -A.
On Wednesday, August 22, 2012 4:34:18 PM UTC-3, imalukegal wrote: > I have a 16 character field, where b=one space, for example: > > A100bb3733312229 > > I have to disregard the last 4 positions -- in this example 2229 and the > first 3 positions (A10). Then, starting in position 4 for a length of 9, I > have to zero fill any blank spaces. In this example, the result should be: > > 000373331 > > The number of leading blanks can change--could be 1,2, or 3. My result > has to be a nine digit character field. > > I am writing a Unix script that calls another file: > > sqlplus USERNAME/PASSWORD$DB <<!EOFSQL > @filepath_name/sql/format.sql > > The format.sql contains the sql that selects and formats this field. Any > suggestions on how to code for this? Nothing that I have tried so far > seems to work. > > Thank you for your help. > > -- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en