Navigation:  NexusDB Guide > SQL Reference > SQL Functions > String Value Functions >

Substring Function

Previous pageReturn to chapter overviewNext page

NexusDB V3 Manual

Substring Function

button_main button_prev button_next

NexusDB Manual V3 > SQL Reference > SQL Functions > String Value Functions

Syntax

 

<character substring function> ::=

 

 

 

SUBSTRING ( <character value expression> FROM start-position

[ FOR string-length ] [ USING { CHARACTERS | OCTETS } ] )

 

Notes

 

§

The SUBSTRING function returns a subset of characters from the source string.

 

§

The start-position argument specifies the ordinal position within the source string where the substring starts.

 

§

The string-length argument specifies how many characters or octets shall be copied from the source string.

 

§

If CHARACTERS is specified, or the USING clause is omitted, then start-position is the ordinal character position within the source string. If OCTETS is specified, then start-position is the byte position.

 

§

If the declared type of the character value expression is a fixed-length or variable-length character string type, then the data type of the result is CHARACTER VARYING or NATIONAL CHARACTER VARYING with a length equal to the fixed length or maximum variable length of the character value expression, otherwise the data type of the result is CHARACTER LARGE OBJECT or NATIONAL CHARACTER LARGE OBJECT.

 

§

If either of the arguments are null, then the result is null.

 

 

Examples

 

 

Expression

 

 

Result

 

SUBSTRING( 'Hello World' FROM 1 )

'Hello World'

SUBSTRING( 'Hello World' FROM 1 FOR 5 )

'Hello'

SUBSTRING( 'Hello World' FROM 7 )

'World'

SUBSTRING( 'Hello World' FROM 7 FOR 5 )

'World'

 

 


Conformance

 

SQL:2003 standard

-

Core SQL

 

© Nexus Database Systems Pty Ltd.

nexus_logo