Home » RDBMS Server » Server Administration » Stored Function returning a big String!!!
Stored Function returning a big String!!! [message #370349] Wed, 01 September 1999 08:46 Go to next message
Jean
Messages: 16
Registered: September 1999
Junior Member
Hi,
is it possible to create a function returning a string greater as 4000 characters?

Thanks for your Help
Re: Stored Function returning a big String!!! [message #370360 is a reply to message #370349] Thu, 02 September 1999 13:18 Go to previous message
hmg
Messages: 40
Registered: March 1999
Member
I say it's not possible.

The only workaround I knew is to use a table structure, like:

create or replace package def
as
type varchar2_type is table of varchar2(4000) index by binary_integer;
end;
/
show errors

create or replace function getBigString
return def.varchar2_type
is
vtab def.varchar2_type;
begin
vtab(1) := lpad('A',4000,'A');
vtab(2) := lpad('B',4000,'B');
vtab(3) := lpad('C',4000,'C');

return ( vtab );
end;
/
show errors

set serveroutput on
declare
atab def.varchar2_type;
begin
atab := getBigString;

dbms_output.put_line( substr(atab(1),1000,255) );
dbms_output.put_line( substr(atab(2),2000,255) );
dbms_output.put_line( substr(atab(3),3000,255) );
end;
/

But you cannot call this function above in a select statement.

HMG
Previous Topic: Dynamic SQL
Next Topic: Dynamic SQL memory problems
Goto Forum:
  


Current Time: Wed Apr 14 18:23:11 CDT 2021