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