'Bind variable in a function
I have this 2 codes
DECLARE
text clob;
begin
:tnr := ' a ; b ;c ' ;
text := :tnr;
end ;
/
with function clb
return clob
is
text clob;
begin
:tnr := ' a ; b ;c ' ;
text := :tnr;
return text;
end ;
select clb from dual;
the first one is working but the second one trhows an error bad bind variable'tnr'.
What I want to achieve. It is not possible to assign more than 4000 character string to a variable of CLOB data type. there is an option to create a teble with CLOB column and assign larg string to bind variable which can be used in an insert statement. I want to avoid this step so I tried to assign larg string (in this example I am using short one as an example) and then assign the value of this bind variable to a clob variable. In the anonymous PL SQL block everything seems to be fine and it works. Unfortunatelly I need to do it in a select statemnt so I try to use a function which can simple assign the string to bind variable then to a clob variable and giv it back so I can use it in the select statement.
As I said I want to avoid the insert statement and to have some table where the string needs to be inserted, commited and if new string coms then the table needs to be truncated to store new string etc.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
