Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> a quick pl/sql question

a quick pl/sql question

From: Guang Mei <gmei_at_incyte.com>
Date: Fri, 16 Jan 2004 10:09:25 -0800
Message-ID: <F001.005DD084.20040116100925@fatcity.com>


Hi:

In pl/sql, I want to add chr(10) into a string in every 70th position. The string can be up to 2000 characters long. The follwoing code works. But is there an even FASTER way to do this?

Thanks.

Guang

---
declare
  pos	number := 1;
  len	number;
  buf	varchar2(2000);
  x varchar2(2100);
begin
  buf :=
'012345678901234567890123456789012345678901234567890123456789012345678901234
5678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789A';

  len := length(buf);
  while pos<=len loop
    x := x || substr(buf, pos, 70) || chr(10);
    pos := pos+70;
  end loop;

end;


--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Guang Mei INET: gmei_at_incyte.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Received on Fri Jan 16 2004 - 12:09:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US