當前位置:成語大全網 - 書法字典 - Mysql字典排序功能

Mysql字典排序功能

如果是oracle,則創建以下函數,並將該函數作為視圖調用以達到所需的效果。

創建或替換函數F _ TRANS _ PINYIN _ CAPITAL(VARCHAR2中的P_NAME)將varchar 2返回為

v _ COMPARE varchar 2(100);

v _ RETURN varchar 2(4000);

函數F _ nls sort(VARCHAR2中的P_WORD)將varchar 2返回為

開始

RETURN nls SORT(P _ WORD,‘NLS _ SORT =中文_拼音_ M‘);

結束;

開始

對於1中的I..長度循環

v _ COMPARE:= F _ NLSSORT(SUBSTR(P _ NAME,I,1));

IF V _ COMPARE & gt= F _ NLSSORT(‘a‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘a‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘八‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘b‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘cha‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘c‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘yi‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘d‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘ü‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘e‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘頭發‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘f‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘Jue‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘g‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘da‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘h‘;

ELSIF V _ COMPARE & gt= f _ nls sort('?')和v _ compare

V _ RETURN:= V _ RETURN | |‘j‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘ka‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘k‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘la‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘l‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘c‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘m‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘塇)和v _ compare

V _ RETURN:= V _ RETURN | |‘n‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘穡)和v _ compare

V _ RETURN:= V _ RETURN | |‘o‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘Ben‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘p‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘seven‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘q‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘乭)和v _ compare

V _ RETURN:= V _ RETURN | |‘r‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘three‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘s‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘π‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘t‘;

ELSIF V _ COMPARE & gt= F _ nls sort(‘尺)和v _ compare

V _ RETURN:= V _ RETURN | |‘w‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘evening‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘x‘;

ELSIF V _ COMPARE & gt= F _ NLSSORT(‘ya‘)和v _ compare

V _ RETURN:= V _ RETURN | |‘y‘;

ELSIF V _ COMPARE & gt= f _ nls sort('?')和v _ compare

V _ RETURN:= V _ RETURN | |‘z‘;

END IF

結束循環;

返回V _ RETURN

結束;