Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   substring in firebird (https://www.delphipraxis.net/152995-substring-firebird.html)

khh 16. Jul 2010 07:15

Datenbank: firebird • Version: 2.1 • Zugriff über: zeos

substring in firebird
 
hallo zusammen, in einem anderen tread habt ihr mir sehr geholfen als es darum ging einen substring in einer mysql-DB zu bearbeiten.

jatz versuche ich das Gleiche unter firebird, und das klappt nicht.
Ist das zu mysql-spezifisch?
Zitat:

UPDATE artikel
SET bezeichnung2 = SUBSTRING(bezeichnung1,-(LOCATE('/',REVERSE(bezeichnung1)) - 1))
Danke gruss KHH

himitsu 16. Jul 2010 07:23

AW: substring in firebird
 
das SubStr scheint 'ne andere Syntax zu haben und man kann anscheinend nicht die Position von hinten (negativer Y-Wert) angeben.
http://wiki.firebirdsql.org/wiki/ind...page=SUBSTRING

LOCATE, sowie REVERSE kennt FB anscheinend nicht ... diese Funktionen werden dort wohl einen anderen Namen besitzen.

khh 16. Jul 2010 07:28

AW: substring in firebird
 
Zitat:

Zitat von himitsu (Beitrag 1035632)

LOCATE, sowie REVERSE kennt FB anscheinend nicht ... diese Funktionen werden dort wohl einen anderen Namen besitzen.

ja aber welchen ? :-(

himitsu 16. Jul 2010 07:29

AW: substring in firebird
 
eventuell POSITION statt LOCATE :gruebel:
http://tracker.firebirdsql.org/browse/CORE-1511

khh 16. Jul 2010 07:33

AW: substring in firebird
 
Zitat:

Zitat von himitsu (Beitrag 1035635)
eventuell POSITION statt LOCATE :gruebel:
http://tracker.firebirdsql.org/browse/CORE-1511

ok, ist nicht soooo dringend, werd ich bei Gelegenheit ausprobieren,

danke dir

tsteinmaurer 16. Jul 2010 07:55

AW: substring in firebird
 
Mit Firebird 2.1: SUBSTRING, REVERSE, POSITION. Siehe Firebird 2.1 Release Notes S.150ff

Thomas

borwin 16. Jul 2010 08:05

AW: substring in firebird
 
Die Buildin Funktionen sind auch im Verzeichnis von FB unter
doc\sql.extensions\README.builtin_functions.txt
beschrieben. Leider nicht Substring. Hier nachsehen was Thomas beschreibt.

Hier noch der Text aus der Release Nodes
Zitat:

(1.0) SUBSTRING( <string expr> FROM <pos> [FOR <length>])
Internal function, available in SQL and DSQL, implementing the ANSI SQL SUBSTRING() function. It will
return a stream consisting of the byte at <pos> and all subsequent bytes up to the end of the string. If the optional
FOR <length> is specified, it will return the lesser of <length> bytes or the number of bytes up to the end
of the input stream.
The first argument can be any expression, constant or identifier that evaluates to a string.
<pos> must evaluate to an integer. <pos> in the string starts at 1, like other SQL positional elements.
Neither <pos> nor <length> can be query parameters: they must evaluate to constants.
Because <pos> and <length> are byte positions, the identifier of the input string can be a binary blob, or a
sub_type 1 text blob with an underlying one-byte-per-character charset. The function currently does not handle
text blobs with Chinese (2 byte/char maximum) or Unicode (3 byte/char maximum) character sets.
For a string argument (as opposed to a blob), the function will tackle ANY charset.
Example
UPDATE ATABLE
SET COLUMNB = SUBSTRING(COLUMNB FROM 4 FOR 99)
WHERE ...
Gruß Borwin


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:52 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz