Skip to Main Content

Japanese

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQLでのソートにつきまして

2742818Aug 31 2014 — edited Sep 3 2014

お世話になります。

システム開発をしておりまして以下のようなデータを持つテーブルに対して、

SQL文でソートを掛けたいのですが、欲しい結果通りに取得することができず、

皆様のお知恵をお借りしたく投稿させて頂きました。

環境:oracle10.2

テーブル(例)

 No(varchar2  4桁)

 ------------

 0001

 1

 10

 1-10

 1-1

 1-02

 0002

 2

 A1-1

 A1

欲しい結果(ソート後)としまして、

 ・ 0始まりのものは0を外した数字順(「0001」は「1」として数字順)

 ・ ハイフンを含むものは、ハイフンの左側の数字順(※)に並べて、次にハイフンの右側の数字順(※)

   (※0始まりのものは0を外した数字順)

 ・ アルファベットは数字の後にする

の順に並べた結果を取得したいと考えております。

欲しい結果(ソート後)

 0001

 1

 1-1

 1-02

 1-10

 0002

 2

 10

 A1

 A1-1

何卒宜しくお願い致します。

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2014
Added on Aug 31 2014
3 comments
6,340 views