Subject Re: Some SUBSTRING extra features?
Author legrand_legrand_63
You should use some of the "rfunc UDF Library" ( found in sourceforge)
like:

select STRPOS('_','AAA_ID') from dual; --> 4
or
select STRREPLACE('AAA_ID','_ID','') from dual; --> AAA

Regards
PAscal


--- In firebird-support@yahoogroups.com, "majstoru" <majstoru@...> wrote:
>
> Hi,
>
> I have a small problem with firebird SQL when I'm using SUBSTRING
> statemen.
> I have generator's named GEN_NAMEGEN_ID, when I need to return set of
> all generators I make a SQL statement on a system table
> RDB$GENERATORS, so I neeg to have only a generator name with out GEN_
> and _ID.
>
> For Example:
> Generator name is: GEN_NAMEGEN_ID
> Result field value: NAMEGEN
>
> If I use
> SELECT SUBSTRING(RDB$GENERATOR_NAME FROM 5)
> FROM RDB$GENERATORS
> WHERE RDB$GENERATOR_NAME LIKE 'GEN_%'
> I'll get all generators name with _ID after name, AND I need to trim
> last 3 chars from end of a result word (_ID).
>
> Is there any solution in Firebird SQL for my example?
>
> Thanks in advace... ;-)
>