Search notes:

Oracle: Init parameter CURSOR_SHARING

The value of cursor_sharing can be set either to
Ideally, the value of cursor_sharing is set to exact. But sometimes, there are applications that don't use bind variables. In that case, the value of cursor_sharing can be set to force in which case Oracle will substitute constants with bind variables and provide the substituted value for the bind variable.
alter session set cursor_sharing = force;

select /* cursor_sharing = force */ * from dual where 0 = 1;
select /* cursor_sharing = force */ * from dual where 0 = 2;
select /* cursor_sharing = force */ * from dual where 0 = 3;

alter session set cursor_sharing = exact;

select /* cursor_sharing = exact */ * from dual where 0 = 4;
select /* cursor_sharing = exact */ * from dual where 0 = 5;
select /* cursor_sharing = exact */ * from dual where 0 = 6;

select
   substr(sql_text, 1, 59) sql_text,
   executions,
   parse_calls,
   sharable_mem,
   persistent_mem,
   runtime_mem
from
   v$sql
where
   sql_text like 'select /* cursor_sharing =%'
order by
   sql_text;
--
-- SQL_TEXT                                                    EXECUTIONS PARSE_CALLS SHARABLE_MEM PERSISTENT_MEM RUNTIME_MEM
-- ----------------------------------------------------------- ---------- ----------- ------------ -------------- -----------
-- select /* cursor_sharing = exact */ * from dual where 0 = 4          1           1        19420          16248       14840
-- select /* cursor_sharing = exact */ * from dual where 0 = 5          1           1        19420          16248       14840
-- select /* cursor_sharing = exact */ * from dual where 0 = 6          1           1        19420          16248       14840
-- select /* cursor_sharing = force */ * from dual where :"SYS          3           3        23598          32552       30904

See also

The value of cursor_sharing can be set to exact for the duration of the execution of an SQL statement with the cursor_sharing_exact SQL hint.
It turned out that the value of cursor_sharing must be set to exact for the ODCI table example.
to_number(… default on version error) fails with the error message ORA-43907: This argument must be a literal or bind variable. if cursor_sharing is set to force.
ORA-43918: This argument must be a literal
Event 10601
init parameters

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...', 1740458388, '3.134.78.192', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/adminstration/init-parameters/cursor_sharing(91): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78