Search Postgresql Archives

using regexp_matches and array manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Can anyone give me an example of how to use regexp_matches and use the captured values?

For instance, if I have a delimited string "a,b,c" and I want to put each letter into a variable so I can subsequently use those variables in an insert statement, how would I do that? I know regexp_matches returns a text array, but how do I assign the value to an array and then access those values?

leaselog=# select regexp_matches('a,b,c','(.*),(.*),(.*)');

~ regexp_matches
- ----------------
~ {a,b,c}
(1 row)


I've tried select into, but that just created a table and didn't put the values into an array variable.
leaselog=# select regexp_matches('a,b,c','(.*),(.*),(.*)') into foo;


Thanks in advance!


Rgds,

Bret
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFIgT2T/PgQIGRJuUcRAvMGAJ9VRNfc5ZZsFtS2LG8VJgPNNnL1wwCfewlf
Jih6ReqSTj6Pp9Ya3B2uMn8=
=HbPn
-----END PGP SIGNATURE-----



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux