Search notes:

Oracle: DBMS_SQL.LAST_ERROR_POSITION

DDL

dbms_sql.last_error_position can be used to find out where a DDL statement has an error:
set serveroutput on

declare
   c  integer;
  
   sql_text varchar2(1000) := q'[
      create table tq84_dup_col (
          a   varchar2(10),
          b   number  ( 4),
          c   date        ,
          d   integer     ,
          c   varchar2( 5),
          f   number  ( 2)
      )
   ]';
begin
 
   c := dbms_sql.open_cursor();
 
   dbms_sql.parse(c, sql_text, dbms_sql.native);
  
exception when others then
--
-- Print the first 20 characters after the error
--
   dbms_output.put_line(substr(sql_text, dbms_sql.last_error_position, 20));
end;
/

DML

For DML statements, dbms_sql.execute needs to be called as well:
declare
   c  integer;
   r  integer;
   sql_text varchar2(1000) := q'[insert into tq84_ora_01438_test values(1, 12, 123, 1234, 12345)]';
begin

   c := dbms_sql.open_cursor();

   dbms_sql.parse(c, sql_text, dbms_sql.native);
   r := dbms_sql.execute(c);

exception when others then
   dbms_output.put_line(dbms_sql.last_error_position);
   dbms_output.put_line(substr(sql_text, dbms_sql.last_error_position, 20));
end;
/

See also

dbms_sql

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...', 1758200826, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/installed/packages/dbms/sql/api/last_error_position(88): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78