SQL Language (MOSC)

MOSC Banner

4000 char size with function-drived virtual column

edited Dec 21, 2013 12:19AM in SQL Language (MOSC) 16 commentsAnswered
Hello,

I have a virtual column driven by a function, this function returning a varchar2(50)

create or replace
function F_ETAT_PROC_TRANS(pCode varchar2) return varchar2
deterministic
is
  val varchar2(50);
begin
  begin
    select valeur into val from CL_ETAT_PROC_TRANS where code=pCode ;
  exception
  when no_data_found then
    return null;
  end;
  return val;
end;
/

ALTER TABLE PROCEDURE DROP COLUMN ETAT_PROC;
<...>
ALTER TABLE PROCEDURE ADD
 (ETAT_PROC VARCHAR2(50) GENERATED ALWAYS AS (F_ETAT_PROC_TRANS(C_ETAT_PROC))

<...>
 );
 

I have the following message

         *
ERROR at line 2:
ORA-12899: value too large for column "ETAT_PROC" (actual: 200, maximum: 4000)

I have tried with many values for ETAT_PROC, every time the "actual value" returned in the message is 4 times the value specified for ETAT_PROC.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center