我的表格包含lastName
UNICODE
我需要实现SOUNDEX
功能,但它不会起作用,因为它只需要latin
。所以我尝试将其转换为latin
但仍然得到相同的错误only latin letters allowed
这是我试过的
SEL *
FROM tab_test
WHERE SOUNDEX(REGEXP_REPLACE(lastName, '[^A-Z]', '')) = 'smith'
SEL *
FROM tab_test
WHERE SOUNDEX(TRANSLATE(lastNameUSING unicode_to_latin)) = 'smith'
如何更正问题
编辑
这就是我所尝试的,正如dnoeth所暗示的那样。但它仍然无效
SEL *
FROM tab_test
WHERE SOUNDEX(TRANSLATE(REGEXP_REPLACE(
lastName,'[^a-zA-Z]','') USING
UNICODE_TO_LATIN)) = 's530'
编辑2
以下是无效的查询
SEL lastName, REGEXP_REPLACE(lastName, '[^a-zA-Z]', '') lastName_regex
FROM (SEL *
FROM tab_test
WHERE personId < 10
) der
WHERE SOUNDEX(REGEXP_REPLACE(lastName, '[^a-zA-Z]', '')) = 's530'
REGEXP子查询的结果如下
SEL lastName, REGEXP_REPLACE(lastName, '[^a-zA-Z]', '') lastName_regex
FROM (SEL *
FROM tab_test
WHERE personId < 10
) der
结果直接从teradata sql assistant
复制 LASTNAME lastName_regex
1 Smith Smith
2 Smith Smith
3 Smith Smith
4 Smith Smith
5 Smith Smith
6 Smith Smith
7 Smith Smith
8 Smith Smith
答案 0 :(得分:3)
你的正则表达式也删除了小写的a到z。
所以试试
REGEXP_REPLACE(lastName, '[^a-zA-Z]', '') -- explicitly add lowercase
或
REGEXP_REPLACE(lastName, '[^A-Z]', '',1,0,'i')) -- do a case insensitive comparison
顺便说一下,SOUNDEX('smith')
的结果不是'史密斯',而是's530'。
答案 1 :(得分:0)
您可能需要
{
"name": "ebr",
"author": "vj",
"version": "1.0.0",
"scripts": {
"postinstall": "typings install",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20",
"bootstrap": "^3.3.6",
"jquery": "^2.2.0",
"jquery-sparkline": "^2.3.2",
"ng2-bootstrap": "^1.1.0",
"ng2-pagination": "^0.4.1",
"pdfmake": "0.1.18"
},
"devDependencies": {
"browser-sync": "^2.14.0",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-clean-css": "^2.0.12",
"gulp-concat": "^2.6.0",
"gulp-plumber": "^1.1.0",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-tfs-checkout": "^1.0.2",
"gulp-tsc": "^1.1.5",
"gulp-tslint": "^6.0.2",
"gulp-typescript": "^2.13.6",
"gulp-uglify": "^2.0.0",
"gulp-watch": "^4.3.9",
"path": "^0.12.7",
"run-sequence": "^1.2.2",
"systemjs-builder": "^0.15.31",
"tslint": "^3.14.0",
"typescript": "^2.0.2",
"typings": "^1.3.2"
}
}
即&#34; +&#34;
答案 2 :(得分:0)
尝试使用UNICODE_TO_LATIN和ERROR