Pages

How to print long text in oracle

Sometimes it is necessary to print and have a look at the strings when we are doing dynamic works on the programming and querying world. In oracle/plsql, unluckily the Dbms_output.put_line(), function does not support more then 255 characters.

Well, we can create an additional procedure just for the purpose of printing the long text for such purpose.
CREATE OR REPLACE PROCEDURE SP_PRINT(longText VARCHAR2)
AS
  querylength        INT:= 0;
  ind                 INT := 1;
  leng                INT := 200;
BEGIN
  querylength := Length(longText);
   WHILE (ind <= querylength)
   LOOP
       Dbms_Output.Put_Line(SubStr(longText, ind, leng));
       ind := ind + leng;
   END LOOP;

END;

No comments:

Post a Comment

If you like to say anything (good/bad), Please do not hesitate...