PREFIX ( char_expression , start_pos , char_expression )
|
create table prefix_table
( colstring varchar(20), colchar char(1) ); insert into prefix_table values ('string.with.dots', '.'); insert into prefix_table values ('string-with-dashes', '-'); select colstring, colchar, prefix(colstring, 1, '.') from prefix_table; COLSTRING COLCHAR prefix(COLSTRING,1,.) --------------------- --------------------- ---------------------- string.with.dots . string string-with-dashes - string-with-dashes select colstring, colchar, prefix(colstring, 1, colchar) from prefix_table; COLSTRING COLCHAR prefix(COLSTRING,1,COLCHAR) --------------------- --------------------- ---------------------------- string.with.dots . string string-with-dashes - string select colstring, colchar, prefix(colstring, 1, 'X') from prefix_table; COLSTRING COLCHAR prefix(COLSTRING,1,X) --------------------- --------------------- ---------------------- string.with.dots . string.with.dots string-with-dashes - string-with-dashes |