On 10/14/15 8:38 AM, Ramesh T wrote:
Hi All,
Do we have function like regexp_substr in postgres..?
in oracle this function seach the - from 1 to 2 and return result,
regexp_substr(PART_CATG_DESC,'[^-]+', 1, 2)
Use regexp_split_to_array(string text, pattern text [, flags text ]):
On Thu, Oct 15, 2015 at 8:32 AM, Ramesh T
wrote:
> select position('-' in '123-987-123')
> position
> ---
> 4
> But I want second occurrence,
> position
> -
> 8
>
> plz any help..?
>
>
SELECT length((regexp_matches('123-987-123',
On Thu, Oct 15, 2015 at 10:05 AM, Ramesh T
wrote:
> '123-987-123' it is not fixed some times it may be '1233-9873-123-098'
> as you said it's fixed,
>
> changes the values in middle of the -
>
> sometimes times i need 1233 and 098 or 9873,first position i'll find
>
On 10/15/2015 07:05 AM, Ramesh T wrote:
> '123-987-123' it is not fixed some times it may be '1233-9873-123-098'
> as you said it's fixed,
>
> changes the values in middle of the -
>
> sometimes times i need 1233 and 098 or 9873,first position i'll find
> direct for second variable we don't
'123-987-123' it is not fixed some times it may be '1233-9873-123-098'
as you said it's fixed,
changes the values in middle of the -
sometimes times i need 1233 and 098 or 9873,first position i'll find
direct for second variable we don't know where it's end with -
i.e ,
i need to find second
select position('-' in '123-987-123')
position
---
4
But I want second occurrence,
position
-
8
plz any help..?
On Thu, Oct 15, 2015 at 12:54 AM, David G. Johnston <
david.g.johns...@gmail.com> wrote:
> On Wed, Oct 14, 2015 at 9:38 AM, Ramesh T
>
Well you could use
SELECT LENGTH(REGEXP_REPLACE('123-987-123', '(([^-]*-){2}).*', '\1'));
Not pretty, but it works.
Geoff
On 15 October 2015 at 15:05, Ramesh T wrote:
> '123-987-123' it is not fixed some times it may be '1233-9873-123-098'
> as you said it's
On 15/10/15 14:32, Ramesh T wrote:
> select position('-' in '123-987-123')
> position
> ---
> 4
> But I want second occurrence,
> position
> -
> 8
>
> plz any help..?
For instance:
# select char_length(substring('123-987-123' from '^[^-]*-[^-]*-'));
char_length
-
8
yes David gave correct solution
but , the value I'm using and it's column in the table sometimes value
may be '123-987-123' or '123-987-123-13-87'
if pass like below must return else condiion 0,
select case when select split_part('123-987-123','-',4) >0
then 1 else 0 end
it's return error
On Thu, Oct 15, 2015 at 3:15 PM, Ramesh T
wrote:
> yes David gave correct solution
>
> but , the value I'm using and it's column in the table sometimes value
> may be '123-987-123' or '123-987-123-13-87'
>
>
So adapt the answer provided to match your data.
if
Hi All,
Do we have function like regexp_substr in postgres..?
in oracle this function seach the - from 1 to 2 and return result,
regexp_substr(PART_CATG_DESC,'[^-]+', 1, 2)
On Wed, Oct 14, 2015 at 9:38 AM, Ramesh T
wrote:
> Hi All,
> Do we have function like regexp_substr in postgres..?
>
> in oracle this function seach the - from 1 to 2 and return result,
> regexp_substr(PART_CATG_DESC,'[^-]+', 1, 2)
>
Maybe one of the
Hello,
see
http://postgresql.1045698.n5.nabble.com/pg-stat-statements-with-query-tr
ee-based-normalization-td4989745.html
Is there a plan to make this query normalization available as a
postgres function.
i.e.: select pg_norm_query (query text , OUT normed_query text )
best reagards,
Marc
13 matches
Mail list logo