bother, in the time that it takes for me to run the same thing 3 times to ensure it was repeatable 2 people beat me to it. I'd add that mySQL has both a substr and substring function and MSSQL has a substring function only (so I expect they've lifted code from that). > Given the obvious lack of mastery of PL/SQL (I have already met many > developers who thought that select into from dual was the only way to assign > a value to a variable in PL/SQL), I suspect it was some quick and dirty port > from a DBMS that has a substring() function, such as MySQL or Sybase/SQL > Server. You should teach your developers grep and sed. > > -- Niall Litchfield Oracle DBA http://www.orawin.info