Search notes:

Oracle SQL: TO_LOB

to_lob converts a long or a long raw to a lob data type.
--
--    https://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:510622111991
--
create table tq84_t1(
    x int,
    y long
); 

create table tq84_t2(
  x int,
  y clob
); 

insert into tq84_t1 values(1, rpad('*',4000,'*')); 

insert into tq84_t2  select x, to_lob(y) from tq84_t1; 

begin
  insert into tq84_t2 select x, to_lob(y) from tq84_t1;
end;
/

column y_ format a100 
select
  x,
  substr(y, 1, 100) y_
from
  tq84_t2;

drop table tq84_t1;
drop table tq84_t2;
Github repository Oracle-Patterns, path: /SQL/functions/to_lob.sql

WTF

WTF, or more specifically, why?
The following select statement throws ORA-00932: inconsistent datatypes: expected - got CLOB (With the improved error messsages it throws ORA-24856: invalid use of TO_LOB operator):
select to_lob(data_default) def_dat from user_tab_columns;
But if the same select statement is used in a create table … as select … statement, it works and the table will be created:
create table tq84_to_lob_wtf as
select to_lob(data_default) def_dat from user_tab_columns;
-- Table TQ84_TO_LOB_WTF created.
 
desc tq84_to_lob_wtf;
-- Name    Null? Type
-- ------- ----- ----
-- DEF_DAT       CLOB
Cleaning up
drop table tq84_to_lob_wtf;

See also

Error messages such as

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758198440, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL/functions/lob/to/index(98): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78