Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create or replace function public.GET_SplittedStrings_fn(
- pSource varchar,
- pSplitter varchar(10)
- )
- returns TABLE(data_n integer , data_item varchar(1000))
- language plpgsql
- AS $$
- BEGIN
- DECLARE
- p integer;
- l integer;
- value varchar(1000);
- begin
- l = LEN(pSplitter);
- WHILE LEN(pSource) > 0 loop
- select p =strpos(pSource, pSplitter);
- if p = 0 then
- select p = LEN(pSource) + l;
- end if;
- value = LEFT(pSource, p-1);
- insert into data select value;
- pSource = SUBSTRING(pSource, p+l, LEN(pSource));
- END loop;
- return;
- end;
- END;
- $$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement