Wrong result When calling PLSQL function from with clause.

(Doc ID 2381714.1)

Last updated on APRIL 09, 2018

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.4 and later
Information in this document applies to any platform.

Symptoms

Issue related to order of parameters passed in SQL query. Following simple example illustrate an issue:

create or replace function f1(p1 varchar2, p2 varchar2)
return varchar2
as
begin
 return p1||' '||p2;
end;
/

with q as (select f1(p2=>'b', p1=>'a') as f from dual)
select q.f, q.f as f2
from q;


F F2
---------- ----------
b a a b
1 row selected.


with q as (select f1(p1=>'a',p2=>'b') as f from dual)
select q.f, q.f as f2
from q


F F2
---------- ----------
a b a b
1 row selected.

Note that the first query output should be "b a, b a", but it is showing as "b a, a b"

 

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms