Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Oracle 11 Gを使用しており、次のデータセットがあります。
12.0 4.2 Version.1 7.9 abc.72
ピリオドの前のすべての文字列文字を返したい。これを実現するには、どのようなクエリを実行しますか?どんな助けでも大歓迎です、ありがとう!
と の組み合わせを試すことができinstrますsubstr。
instr
substr
このようなもの:
select substr(field, 1, instr(field, '.') - 1) from your_table;
field常に.文字が含まれていると仮定します。
field
.
.by usingcaseや、ifOracle の SQL 言語実装での他の同様の有効な条件関数を使用せずに文字列を処理することもできます。
case
if
もちろん、いつでもこれを関数に配置して、クエリで見栄えを良くすることができます。