类似”Celmer,Kenneth Raymond”,"Cockrell Jr,Robert Charles”,"St John,Michael Raymond”需要取出颠倒然后用空格分隔取出第一个名字“Kenneth Celmer”,”Robert Cockrell”,”Michael St’。

通过ITPUB高手指点,可用如下代码实现。

SELECT
name full_name,
REGEXP_REPLACE(name,'\s*(\S+)[^,]*\,+\s*(\S+)[^,]*','\2 \1')
name,
userid username,
emplid,
jobtitle title,
location,
business_unit_4,
empl_status status
FROM employee_data@dwtst_tms t ,tms_location loc
WHERE loc.business_unit=t.location and jobcode IN
('000055', '000457', '000449', '000383', '000492', '000308');

另种写法:

select column_value src_name, regexp_replace(column_value, '([^ ]*)([^,]*),([^ ]*).*', '\3 \1') real_name
2 from table(sys.odcivarchar2list('DAngelo,James Thomas' ,'Perez Nunez,Ricardo','Czarnecki,Curtis A'))

相关文章:

  • 2022-12-23
  • 2023-03-19
  • 2022-12-23
  • 2022-02-07
  • 2022-01-02
  • 1970-01-01
猜你喜欢
  • 2021-12-29
  • 2021-11-24
  • 2021-12-29
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案