Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PLS-00215: String length constraints must be in range (1 .. 32767)

M.EmmanuelOct 16 2016 — edited Oct 17 2016

I am trying to define a function to work out the checksum digit of an EAN13 barcode.

While trying to compile I get PLS-00215 String length constraints must be in range (1 .. 32767) for the following line:

    ean13   varchar2;

[code]

function ean13_with_checkdigit(
  
   p_ean13_without_checkdigit in varchar2

   

    )

    return varchar2

    as

   checksum_digit    varchar2;
   ean13   varchar2;
   l_sum    number;
   l_multiple   number;

    begin

   for i in 1..12 loop
   if mod(i,2) = 0 then
   l_multiple := 3;
   else
   l_multiple := 1;
   end if;

   l_sum := nvl(l_sum, 0) + substr(p_ean13_without_checkdigit, i, 1) * l_multiple;
   end loop;

   checksum_digit := TO_CHAR(10 - mod(l_sum, 10), 'FM0');

   ean13 := p_ean13_without_checkdigit || checksum_digit;
  
   return ean13;

    end;

[/code]

Any help is welcomed

This post has been answered by Paulzip on Oct 16 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 14 2016
Added on Oct 16 2016
4 comments
11,290 views