sql - Oracle Loop through table until variable length is full -


i trying create loop in oracle using sql developer.

i looping through table , storing content varchar 4000 characters.

when total amount of value goes higher 3500 want exit loop , warn user.

below code have made far....

begin      declare       comp_str varchar2(4000) := null;       varlength varchar2(4000):= null;        cursor c1         select column1, column2, column3         table         column1 = 'value';     begin         c1_rec in c1         loop          select length(comp_str) varlength dual;                              if varlength < 3500                      if comp_str null                 comp_str := c1_rec.string1 || ',' || c1_rec.string2;             else                               comp_str := comp_str || ' <br> ' || c1_rec.string1 || ',' || c1_rec.string2;             end if;             else             comp_str := comp_str || '<br><br>end of limit ';             exit ;           end if;          end loop;     end; end; 

you should change type of varlength varchar2 number;


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -