Advertisement

04.04.2008 at 12:46PM PDT, ID: 23297200
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

What parameter changes the default length of dbms_lob.substr?

Asked by geotiger in Oracle 10.x, Sun Solaris, PL / SQL

Here are my codes:

CREATE OR REPLACE PROCEDURE exec_now (
  s      CLOB,                     -- SQL statements
  p_lvl  INTEGER  DEFAULT 0        -- message level      
) IS
  v_prg  VARCHAR2(100) := 'exec_now';
  n      NUMBER;
  m      NUMBER;
  msg    VARCHAR2(200);

  PROCEDURE echo (
    msg clob,
    lvl NUMBER DEFAULT 999
  ) IS
  BEGIN
    IF lvl <= p_lvl THEN
        dbms_output.put_line(msg);
    END IF;
  END;

BEGIN
  n := dbms_lob.getlength(s);
  msg := 'INFO('||v_prg||'): '||TO_CHAR(n)||' characters.';
  echo(msg, 1);
  dbms_output.enable(1000000);
  IF n < 32767 THEN
      echo('INFO('||v_prg||'): executing codes (1)...', 1);
      m := LENGTH(DBMS_LOB.SUBSTR(s));
      -- echo(DBMS_LOB.SUBSTR(s), 1);
      msg := 'INFO('||v_prg||'): '||TO_CHAR(m)||'/'||TO_CHAR(n)||' characters.';
      echo(msg, 1);
      EXECUTE IMMEDIATE DBMS_LOB.SUBSTR(s);
      msg := 'INFO('||v_prg||'): OK!';
  ELSIF n < 64000 THEN
      echo('INFO('||v_prg||'): executing codes (2)...', 1);
      m := n - 32000;
      EXECUTE IMMEDIATE DBMS_LOB.SUBSTR(s, 32000, 1)||DBMS_LOB.SUBSTR(s, m, 32001);
      msg := 'INFO('||v_prg||'): OK!';
  ELSE
      msg := 'ERR('||v_prg||'): ';
      msg := msg||'skipped - too long('||TO_CHAR(n)||').';
  END IF;
  echo(msg,1);

  EXCEPTION  
  WHEN OTHERS THEN  
    echo('ERR('||v_prg||'): '||SQLERRM,0);
    raise;
END;
/  

show err

DECLARE
  s CLOB;
  s1   LONG;
  s2   LONG;
  n    NUMBER;
BEGIN
  dbms_lob.createtemporary(s, TRUE);
  dbms_lob.open(s, dbms_lob.lob_readwrite);
  s1 := 'BEGIN null; ' || LPAD (' ', 32000, ' ');
  n := length(s1||' END;'); dbms_lob.writeappend(s, n, s1||' END;');  
  exec_now(s,5);
  dbms_lob.close(s);

  dbms_lob.createtemporary(s, TRUE);
  dbms_lob.open(s, dbms_lob.lob_readwrite);
  -- n := dbms_lob.getlength(s); dbms_lob.erase(s, n, 1);
  n := length(s1);            dbms_lob.writeappend(s, n, s1);  
  s2 := RPAD (' ', 12000, ' ') || ' END;';
  n := length(s2); dbms_lob.writeappend(s, n, s2);    
  exec_now(s,5);
  dbms_lob.close(s);

END;
/

I used the above test code and got two different outputs:

in instance on Window 2003 server:
----------------------------------
INFO(exec_now): 32017 characters.
INFO(exec_now): executing codes (1)...
INFO(exec_now): 32017/32017 characters.
INFO(exec_now): Codes in was executed.
INFO(exec_now): 44017 characters.
INFO(exec_now): executing codes (2)...
INFO(exec_now): Codes was executed.

PL/SQL procedure successfully completed.

In instance on Solaris server
-------------------------------
INFO(exec_now): 32017 characters.
INFO(exec_now): executing codes (1)...
INFO(exec_now): 8191/32017 characters.
ERR(exec_now): ORA-06550: line 1, column 8191:
PLS-00103: Encountered the symbol
 "end-of-file" when expecting one of the following:

Q: What parameter sets the limit on what dbms_lob.substr returns? It is supposed to be 32k but it only returns 8k in one of the Oracle instances. Both instances are Oracle 10.2.0.3.





Start Free Trial
 
Loading Advertisement...
 
[+][-]04.06.2008 at 06:04PM PDT, ID: 21293784

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.07.2008 at 08:08AM PDT, ID: 21297631

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 08:39AM PDT, ID: 21297954

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 10:10AM PDT, ID: 21298735

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 06:28PM PDT, ID: 21301886

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 05:00AM PDT, ID: 21304268

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 07:03AM PDT, ID: 21500087

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 07:04AM PDT, ID: 21500095

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle 10.x, Sun Solaris, PL / SQL
Sign Up Now!
Solution Provided By: geotiger
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628