Oracle SQL-解析名称字符串并将其转换为第一个初始&姓 [英] Oracle SQL - Parsing a name string and converting it to first initial & last name

查看:136
本文介绍了Oracle SQL-解析名称字符串并将其转换为第一个初始&姓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道怎么把这个字符串变成:史密斯,约翰·R"
放入此字​​符串:"jsmith"吗?

Does anyone know how to turn this string: "Smith, John R"
Into this string: "jsmith" ?

我需要使用lower()小写所有内容
查找逗号在哪里并跟踪其整数位置值
获取该逗号后的第一个字符,并将其放在字符串的前面
然后获得完整的姓氏,并将其粘贴在第一个名字首字母之后.

旁注-instr()函数与我的版本不兼容

感谢您的帮助!

I need to lowercase everything with lower()
Find where the comma is and track it's integer location value
Get the first character after that comma and put it in front of the string
Then get the entire last name and stick it after the first initial.

Sidenote - instr() function is not compatible with my version

Thanks for any help!

推荐答案

首先编写您自己的INSTR函数-例如,将其命名为my_instr.它将从char 1开始并循环直到找到','.

Start by writing your own INSTR function - call it my_instr for example. It will start at char 1 and loop until it finds a ','.

然后像使用INSTR一样使用.

Then use as you would INSTR.

这篇关于Oracle SQL-解析名称字符串并将其转换为第一个初始&姓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆