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

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL question.

Re: PL/SQL question.

From: Tomm Carr <tommcatt_at_geocities.com>
Date: 1997/07/29
Message-ID: <33DE3DD0.2FB@geocities.com>#1/1

Logo Palanisamy wrote:
>
> Is there a way to print strings longer than 255 characters in
> PL/SQL version 2.2. dbms_output.put_line doesn't work.

Here are my procedures from a dbms_output wrapper package. Forgive the spacing, I have tabs set to 3 in my editor.

kEOL constant Char := chr( 10 );

Procedure PutLines( Line in VarChar2 )
is

	CharPos	Integer	:= 1;
	LineLen	Integer	:= length( Line );
	EOLPos	Integer;
	EOLFound	Boolean;
begin
	loop
		EOLPos	:= instr( Line, kEOL, CharPos );
		EOLFound	:= (EOLPos > 0) and (EOLPos < (CharPos + 254 ));

		if not EOLFound then
			EOLPos	:= least( CharPos + 254, LineLen );
		end if;

		if EOLFound then
			DBMS_OUTPUT.PUT_LINE( substr( Line, CharPos, EOLPos - CharPos ));
			CharPos	:= EOLPos + 1;
		else
			DBMS_OUTPUT.PUT_LINE( substr( Line, CharPos, EOLPos - CharPos + 1 ));
			CharPos	:= EOLPos;
		end if;

		exit when CharPos >= LineLen;
	end loop;

end;

Procedure PutLine( Line in VarChar2 )
is
begin

	if Line is null then
		NewLine;
	elsif length( Line ) > 255 then
		PutLines( Line );
	else
		DBMS_OUTPUT.PUT_LINE( Line );
	end if;

end;
-- 
Tomm Carr
--
"Can you describe your assailant?"
"No problem, Officer.  That's exactly what I was doing when he hit me!"
Received on Tue Jul 29 1997 - 00:00:00 CDT

Original text of this message

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