Subject | How to extract substring from table names??? |
---|---|
Author | Paul Mercea |
Post date | 2006-04-10T13:09:43Z |
Hi
I use for each module prefix for table names.
Until now I have used 3 character for prefix like this (SYS_USER,SYS_LOG),
and I can use substring(rdb$relation_name from 1 for 3) to extract 'module'
name existing in database.
Now, I need to change this rpefix to 4 and 5 characters.
I would like to use some function like trim , but not working!!!
Is posible to specify * for all letters after _ ??? Something
like:trim(trailing '_' from rdb$relation_name)
I will have tables like
SYS_USER
SYS_LOG
USERS_PRIVILEGE
USERS_EXTRA
MAPS_VIEW
Etc...
I need result like:
SYS
USERS
MAPS
How can I get these results???
Courios think is using leading:
If I use:
trim(trailing '_MAP' from (rdb$relation_name))
Nothing happens, but if I use second trim like:
trim(trailing '_MAP' from trim(rdb$relation_name))
It works...
But steel not ok for me tu get that results.
TIA
Paul
I use for each module prefix for table names.
Until now I have used 3 character for prefix like this (SYS_USER,SYS_LOG),
and I can use substring(rdb$relation_name from 1 for 3) to extract 'module'
name existing in database.
Now, I need to change this rpefix to 4 and 5 characters.
I would like to use some function like trim , but not working!!!
Is posible to specify * for all letters after _ ??? Something
like:trim(trailing '_' from rdb$relation_name)
I will have tables like
SYS_USER
SYS_LOG
USERS_PRIVILEGE
USERS_EXTRA
MAPS_VIEW
Etc...
I need result like:
SYS
USERS
MAPS
How can I get these results???
Courios think is using leading:
If I use:
trim(trailing '_MAP' from (rdb$relation_name))
Nothing happens, but if I use second trim like:
trim(trailing '_MAP' from trim(rdb$relation_name))
It works...
But steel not ok for me tu get that results.
TIA
Paul