sql - How to make a update query in Oracle using "With" statement shorter? -


I am creating an update query.

But it is very messy due to repeated use of "confession" statement.

Do you consider any to reduce it?

The sample query is below.

  Update Table 1 SET C1 = (select from W_VIEW (select from tab 1) Select C_VALUE to W_VIEW where 2 ROWNUM = 1) where in C2 (with W_VIEW as ( Select from * Tab 1) Select C2_VALUES from W_VIEW where STH & lt; 10);   

I just want to use W_VIEW once.

For example, with

  as W_VIEW (select from * tab3) update tab 1 SET C1 = (select C_VALUE to W_VIEW where 2 ROWNUM = 1) Where C 2 IN (SELECT C2_VALUES WHERE STH <10) from   

I would be happy if this question is working :)

Perhaps this one:

 with  update as w_view (select from Table 1) (select * From the table 1 where in C2 (choose from c2_values ​​w_view where sth> 10)) SET c1 = (SELECT c_value w_view where rownum = 1)    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -