My Oracle Support Banner

CURSOR_SHARING does not result in literal substitution for sql statements executed from PS/SQL blocks (Doc ID 790128.1)

Last updated on NOVEMBER 04, 2019

Applies to:

Oracle Database - Enterprise Edition - Version and later
PL/SQL - Version and later
Information in this document applies to any platform.
PL/SQL - Version:
Information in this document applies to any platform.


Database initialization parameter CURSOR_SHARING set to FORCE or SIMILAR does not result in literal substitution for statements executed from PLSQL blocks, as it does for statements executed directly, and can be seen with the following example:

create table foo_direct(co1 number);
create table foo_anon(col1 number);
create table foo_execimm(col1 number);

alter session set cursor_sharing=FORCE;
alter system flush shared_pool;

insert into foo_direct values(1);

begin  insert into foo_anon values(1);  end;

execute immediate 'insert into foo_execimm values(1)';

select sql_text from v$sqlarea where sql_text like '%foo%';

insert into foo_execimm values(:"SYS_B_0")
insert into foo_direct values(:"SYS_B_0")
begin  insert into foo_anon values(1);  end;
begin execute immediate 'insert into foo_execimm values(1)'; end;


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.