PL/SQL (MOSC)

MOSC Banner

How to read a SQL*plus LONG table column value in PL/SQL where data length exceeds 32K

edited Sep 4, 2013 5:30AM in PL/SQL (MOSC) 4 commentsAnswered ✓
I am trying to read the value of DBA_VIEWS.TEXT in PL/SQL. the TEXT column has a long datatype and the TEXT_LENGTH is 38324
set serveroutput on size 1000000
declare
v1 long;
begin
  select text into v1 from dba_views where view_name='PQH_COPY_ENTITY_ATTRIBS_DFV';
end;
/

When v1 has a datatype LONG the following exception is being raised. I presume this is because a PL/SQL LONG datatype has a limit of 32K
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 4

When changing the datatype of v1 to either CLOB or BLOB, the following error is raised

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