Currently, when there's a need to deal with texts, which are longer than 32K, you must use the CLOB.
What I'd like to have is datatype, the same as VARCHAR2, but without max size limits (just like String in C++).
Why not just use CLOB? Because it's just so much slower than VARCHAR2 and (I believe) internally is converted to VARCHAR2 in a lot of cases.
- You would not be able to have it as a database type (there's CLOB for this already)
- You'd be able to assign varchar2/CLOB to it
- You'd be able to assign it to varchar2/CLOB (error about 32K varchar2 would be OK)
- If it becomes too big and session runs out of the memory, that's fine. We'll deal with it.
- Make sure that Replace, Instr, etc. would work with it without 32K varchar2 limits.
- There would be possibility to pre-allocate size for it - for the performace reasons.
- There would be possibility to access individual chars like in the array - for the performace reasons.
So in the code it would look like:
declare
dummy STRING;
v VARCHAR2(100);
c CLOB;
begin
v := 'bla bla';
c := 'bla bla';
dummy := 'Hello world'; -- it would auto allocate itself
dummy := dummy || v; -- this would work
dummy := dummy || c; -- this would work as well
dummy[1] := 'A'; -- change H to A
set_size(dummy, 1024 * 1024, ' '); -- set it's size to 1M, pre-populate with spaces
dummy[33333] := 'x'; -- set 33333rd element to x
dummy[11133333] := 'x'; -- this would throw an out of bounds error
c := dummy; -- this should always work
v := dummy; -- this would throw error about 32K limit, which is fine
end;
-- this would work
type t_string_tab is table of STRING index by binary_integer;
-- this would work
type t_rec is record (
s1 string
s2 string);
-- this would work
type t_string_tab is table of t_rec index by binary_integer;