[Info-ingres] Code example that I can't post on the hopeless Salesforce-powered forum

Roy Hann specially at processed.almost.meat
Thu Jul 20 13:52:02 UTC 2017


If anyone was wondering what that RPP was that I was trying to post on
the Actian communite site, here it is:

create procedure burst_csv ( in csv varchar(250) not null )
result row fields ( field varchar(25) not null )
as
declare field varchar(25) not null;
begin
    while length(csv) > 0
    do
        field=left(csv,locate(csv,',')-1);
        csv=shift(csv,-locate(csv,','));
        return row (field);
    endwhile;
end;

And here's the example of running it:

* select * from burst_csv('tomato,extra cheese,olives,pepperoni') \g
Executing . . .


+-------------------------+
|field                    |
+-------------------------+
|tomato                   |
|extra cheese             |
|olives                   |
|pepperoni                |
+-------------------------+
(4 rows)



More information about the Info-ingres mailing list