oracle pl sql error oracle pl sql error oracle pl sql error
 

Substr Function


In Oracle/PLSQL, the pl sql substr functions allows you to extract a substring from a string.

Le funzioni instr Oracle restituiscono una parte di stringa, cominciante lungamente alla posizione del carattere, caratteri del substring_length. SUBSTR calcola le lunghezze usando i caratteri come definiti dalla serie di caratteri dell'input. SUBSTRB usa i byte anziché i caratteri. SUBSTRC usa i caratteri completi di Unicode. SUBSTR2 usa i codepoints UCS2. SUBSTR4 usa i codepoints UCS4.

Se la posizione è 0, quindi è trattare come 1. Se la posizione è positiva, quindi Oracle conta dall'inizio della stringa per trovare il primo carattere. Se la posizione è negativa, quindi Oracle conta indietro dall'estremità di stringa. Se il substring_length è omesso, quindi Oracle restituisce tutti i caratteri all'estremità di stringa. Se il substring_length è meno di 1, quindi una posizione di segnale minimo è restituita. la stringa può essere c'è ne dei datatypes SI CARBONIZZA, VARCHAR2, NCHAR, NVARCHAR2, CLOB, o NCLOB. Il valore di ritorno è lo stesso datatype della stringa. I numeri di virgola mobile passati come discussioni a SUBSTR sono convertiti automaticamente in numeri interi.

Esempi

Il seguente esempio restituisce parecchie sottostringhe specificate “di ABCDEFG„: SELEZIONARE SUBSTR (“ABCDEFG„, 3.4) “sottostringa„ A PARTIRE da DOPPIO; Sottostringa --------- CDEF SELEZIONANO SUBSTR (“ABCDEFG„, - 5.4) “sottostringa„ A PARTIRE da DOPPIO; Sottostringa --------- CDEF SELEZIONARE SUBSTRB (“ABCDEFG„, 5.4.2) “sottostringa con i byte„ A PARTIRE DA DOPPIO; Sottostringa con i byte -------------------- CD
 
 

substr Oracle

The syntax for the substr function is:

substr( string, start_position, [ length ] )

string is the source string.

start_position is the position for extraction. The first position in the string is always 1.

length is optional. It is the number of characters to extract. If this parameter is omitted, substr will return the entire string.

Note:

If start_position is 0, then instr sql substr treats start_position as 1 (ie: the first position in the string).

If start_position is a positive number, then substr starts from the beginning of the string.

If start_position is a negative number, then sql substring starts from the end of the string and counts backwards.

If length is a negative number, then substr will return a NULL value.

For example:

substr('Merovingio', 6, 2) return 'in'
substr('Merovingio', 6) return 'ingio'
substr('Merovingio', 1, 4) return 'Mero'
substr('Merovingio', -3, 3) return 'gio'
substr('Merovingio', -6, 3) return 'vin'
substr('Merovingio', -8, 2) would return 'ro'
See also insert into Oracle
 
Functions
     
  29-11-2006 Guida Oracle 10g
     
  29-11-2006 Guida Oracle9i
     
  29-11-2006 Create Functions
     
  01-04-2007 Oracle Errors
Functions Oracle Functions
Delete Delete
Between Between
Check Check
Count Count
Datatypes Datatypes
Delete Oracle Delete Statement
Distinct Distinct
Exists Exists
Functions Functions
Grant revoke Grant Revoke
Group by Oracle Group by
Having Having
Oracle Function in Oracle Function in
Indexes Indexes
Insert Insert
Intersect Intersect
Isnull Is null
Joins Joins
Oracle guide Oracle declare vars
 
Oracle Functions PLSQL  l Consulenza Software Verona  l  Siti Web Verona  l   Exceptions  l  Oracle Errors  l  Oracle Collaborations Suite  l  Products  l  Contact
Oracle errors ora