Home > Net > Parse Sql: analyze the select statement from the update statement
Parse Sql: analyze the select statement from the update statement
Time:09-23
There is now a task, there is a batch of orders, update, insert, delete the batch operation, There is also a requirement, when performing operations need to record the history of updating data,
For example:
update tab1 set col='*', col2='* * *' where id in (select tid from tab2 the where the enable='Y
')
my process is like this: 1. first resolved to get:
select * from tab1 where id in (select tid from tab2 the where the enable='Y')
2. execute the select to save historical data to other places,
3. to perform the update command The problem is, how do I parse out the select statement? Statement is not too complex, are all clauses statements, So close, can provide a good way?
CodePudding user response:
Is not resolve the where clause? In the example but you have the insert, insert instruction is no where clause, when are you going to do with?