Chris, Hmmph. People are in a bad mood this week; obviously few other people on the list have had to write applications for the banking industry, which trades everything in flat files. Give Chris a break! > >From an input file where the records looks like this one: > > 020-13 016-05 07-15-2001 23:59:07 00:00:59 09678634321208 > 78634321208 > 0000005300 ^M The answer to your question is somewhat annoying, though: You can't use PL/pgSQL for this task. Basically, two other PostgreSQL function languages - PL/tcl and PL/perl - have excellent text-parsing ability. As such, there is no movement affort to replicate that functionality in PL/pgSQL. So: Hire yourself a perl or tcl hacker. Have them write parsing functions in pl/tclU or pl/perl to load the records. Then have your PL/pgSQL function call the tcl or perl functions. You'll need to get advice from other list members or the docs (and don't forget the "non-FAQ Documentation" page!) on how to use these other languages, as I have had no need for them, to date. -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]