| От | Bret Schuhmacher |
|---|---|
| Тема | using regexp_matches and array manipulation |
| Дата | |
| Msg-id | 48813D94.9060409@welcometolazyhill.com обсуждение |
| Список | pgsql-general |
-----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-----
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера