Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 968929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:33:41+00:00 2026-05-16T02:33:41+00:00

I have the following function: CREATE OR REPLACE FUNCTION GetVarchar2 (iclCLOB IN Nvarchar2) return

  • 0

I have the following function:

CREATE OR REPLACE FUNCTION GetVarchar2 (iclCLOB IN Nvarchar2)
return NVARCHAR2
IS
cnuMAX_LENGTH Constant number := 32767 ;
nuLength Number := DBMS_LOB.getlength(iclCLOB);
sbBuffer Nvarchar2(32767);
begin
dbms_lob.read(iclCLOB,nuLength,1,sbBuffer);
return sbBuffer;
END;

when I call it like this:

select GetVarChar2(text) from posts where postid = 'anId';

I get this error:

ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 6058, maximum: 2000)
22835. 00000 – “Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: %s, maximum: %s)”
*Cause: An attempt was made to convert CLOB to CHAR or BLOB to RAW, where
the LOB size was bigger than the buffer limit for CHAR and RAW
types.
Note that widths are reported in characters if character length
semantics are in effect for the column, otherwise widths are
reported in bytes.
*Action: Do one of the following
1. Make the LOB smaller before performing the conversion,
for example, by using SUBSTR on CLOB
2. Use DBMS_LOB.SUBSTR to convert CLOB to CHAR or BLOB to RAW.

The problem is that the size of text in posts table in of type NCLOB and is 6059 bytes.
It’s strange because when I do this without calling function it runs well. i.e. when I run the following script:

declare 
    iclCLOB nvarchar2(6100) := 'Here is the same 6059 bytes string';
    cnuMAX_LENGTH number := 32767 ;
    nuLength Number := DBMS_LOB.getlength(iclCLOB);
    sbBuffer Nvarchar2(32767);
    sbBuffer1 Nvarchar2(32767);
begin
    dbms_lob.read(iclCLOB,nuLength,1,sbBuffer);
    select GetVarChar2(text) into sbBuffer1 from posts where postid = 'anId';
end;

It runs without any problems.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:33:41+00:00Added an answer on May 16, 2026 at 2:33 am

    NVARCHAR2 can be 32767 bytes in PL/SQL but only 4000 bytes in SQL. Also, try changing the parameter iclCLOB to a NCLOB instead of NVARCHAR2 – the implicit conversion will cause problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 480k
  • Answers 480k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use multiple files for each operation, or put "GO" between… May 16, 2026 at 6:13 am
  • Editorial Team
    Editorial Team added an answer It's not possible. You'll have to do it on the… May 16, 2026 at 6:13 am
  • Editorial Team
    Editorial Team added an answer Per Krzysztof Koźmic: Yes, the default lifestyle is singleton, Unknown… May 16, 2026 at 6:13 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.