M
M
marselabdullin2020-10-26 15:28:52
Oracle
marselabdullin, 2020-10-26 15:28:52

How to insert value from cte into oracle table?

I have a table in which I need to insert values ​​from cte, I use this syntax:

with cte as(
select *
from a
)
insert into b select * from cte where rnk=1;


He answers me missing select and says that there is no cte plate. How can the problem be solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Eroshevich, 2020-10-26
@marselabdullin

Probably something like this, the with construction should be immediately before the select

insert into b
with cte as (select * from a)
 select * 
from cte 
where rnk=1;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question