Skip Headers
Oracle® OLAP DML Reference
11g Release 2 (11.2)

Part Number E17122-07
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub
OLADM679

SUBSTR functions

The SUBSTR functions (SUBSTR, SUBSTRB, and SUBSTRC) return a portion of string, beginning at a specified position in the string. The functions vary in how they calculate the length of the substring to return.

Return Value

The return value is the same data type as string.

Syntax

{SUBSTR | SUBSTRB | SUBSTRC }(char, position [, substring_length ])

Parameters

string

A text expression that is the base string from which the substring is created.

position

The position at which the first character of the returned string begins.

substring_length

The length of the returned string. SUBSTR calculates lengths using characters as defined by the input character set. SUBSTRB uses bytes instead of characters. SUBSTRC uses Unicode complete characters.

When you do not specify a value for this argument, then the function returns all characters to the end of string. When you specify a value that is less than 1, the function returns NA.

Examples

OLADM1938Example 8-122 Retrieving a Character Substring

The following example returns several specified substrings of "abcdefg".

SHOW SUBSTR('abcdefg',3,4) 
cdef

SHOW SUBSTR('abcdefg',-5,4) 
cdef

OLADM1939Example 8-123 Retrieving a Substring Using Bytes

Assume a double-byte database character set.

SHOW SUBSTRB('abcdefg',5,4.2) 
cd
Reader Comment

   

Comments, corrections, and suggestions are forwarded to authors every week. By submitting, you confirm you agree to the terms and conditions. Use the OTN forums for product questions. For support or consulting, file a service request through My Oracle Support.

Hide Navigation

Quick Lookup

Database Library · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Initialization Parameters · Advanced Search · Error Messages

Main Categories

This Document

New and changed documents:
RSS Feed HTML RSS Feed PDF