카테고리 없음

[informix] 인포믹스 substring 사용방법

xemaker 2017. 1. 3. 11:57
인포믹스의 substring은 다른 언어에 비해서 다소 복잡하다.

SUBSTRING Function |--SUBSTRING--(--source_string--FROM--start_position--+-------------+--)--|     '-FOR--length-'    

substring(source from 시작인덱스 for 길이)

여기서 start position 은 1부터 시작한다.


예제를 보며 익혀보자

substring(20161201 from 1 for 6)

하면 결과는

201612

가 된다.

SELECT SUBSTRING('ABCDEFG' FROM 3 FOR 2) FROM mytable;

The following table shows the output of this SELECT statement.

(constant)CD