Home > database >  Oracle update statement can't write, for help
Oracle update statement can't write, for help

Time:11-29

I novice from SQL SERVER just turn oracle learning, SQL update statement before
 UPDATE table, SET A=@ k=@ @ k k + 1 WHERE B=@ j 

How do you write on the Oracle k=k + 1?
 - k and j is variable, added, "k=k + 1" this sentence is error 
The UPDATE table SET A=k, k=k + 1 WHERE B=j


Help you!

CodePudding user response:

The update table set a=: 1 + 1 where b=: using 2 k, j

CodePudding user response:

The original poster write complete some statements,

CodePudding user response:

refer to the second floor selling fruit net reply:
the original poster write complete some statements,

Before the old system using SQL SERVER database, ORACLE database are now with the new system, old system code below
 Select @ I=Max (LEVELS), @ j=1, @ k=0 From @ t 
While @ j<=@ I
The Begin
The Update @ t Set IID=@ k, @ k=@ k + 1 Where LEVELS=@ j
Select @ j=@ j + 1
End

Now want to move to the oracle database, can't write

CodePudding user response:

Done a long time don't know how to writing, also with a stupid way to solve the circulation, and under the guidance of the great god is there a better way to
 select Max (LVL) into the I from t_gt_bomdetail; 
While j<=the I loop
Select count (xh) into k from t_gt_bomdetail where LVL=j;
While k> 0 loop
Update t_gt_bomdetail set where LVL iid=l=j and xh=(select min (xh) from t_gt_bomdetail where LVL=j and iid=0).
K:=k - 1;
L:=l + 1;
End loop;
J:=j + 1;
End loop;

  • Related