Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

12c WITH CLAUSE: INSERT with function

alexoraMar 11 2016 — edited Mar 14 2016


Does anyone know why this simple INSERT using 12c FUNCTION for WITH clause is not working ?

If I remove INSERT select works:

WITH

FUNCTION t_fun(n INTEGER) return varchar2 IS

   BEGIN

   return '2';

END;

tt as ( select 1 t from dual)

select t from tt;

it's working.

desc TEST

Name Null Type       

---- ---- -----------

T1        VARCHAR2(5)

However when I add an insert I'm getting this error:

insert into test

WITH

FUNCTION t_fun(n INTEGER) return varchar2 IS

   BEGIN

   return '2';

END;

tt as ( select 1 t from dual)

select t from tt;

ORA-00942: table or view does not exist

00942. 00000 -  "table or view does not exist"

*Cause:   

*Action:

Error at Line: 53 Column: 15

Thank you,

Alex

This post has been answered by CarlosDLG on Mar 12 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 11 2016
Added on Mar 11 2016
16 comments
3,700 views