Home > database >  Stored procedure related issues
Stored procedure related issues

Time:09-17

I ask you a question about data insert and update, library has three table 1 a, b, c, no data, 2 libraries also have three corresponding table and are open to 1 library corresponding privileges, and there are data, I'd like to call a stored procedure by timing task, realize functions: 1. 2 library all copied to the corresponding data in the table 1, 2. If there is a new library in the table 2, modify, delete, 1 library also related operations on a regular basis, consult everybody how to write the script? I am a rookie a, hope everyone more business

CodePudding user response:

The original poster is which link has a problem?

CodePudding user response:

reference 1st floor selling fruit net reply:
the original poster is which link has a problem?

Can a stored procedure is used to implement the update at the same time four tables of the data?

CodePudding user response:

Yes,

SQL, stored procedures, is in fact a lot of can be multiple lines, can also be a line,

CodePudding user response:

reference 3 floor selling fruit net reply:
,

SQL, stored procedures, is in fact a lot of can be multiple lines, can also be a line,

Could you help me to write a simple demo? Thank you for

CodePudding user response:

The original poster is which link has a problem?

CodePudding user response:

Dblink built, and then write a stored procedure clear table and insert data, match again a timing task calls

CodePudding user response:

First of all, you this requirement is simple to operate, but according to your specific business needs is sure want full amount regularly updated or incremental updating regularly,
1. The total amount of update is very simple, total table truncate, then all dblink insert, write a regular task calls each day ()
2. The incremental updating, need you clear how to change is the change, if only a column (similar to the primary key) have change, can directly detect the column do judgment;
If it is almost every column are likely to change change, so suggest to make the trigger,

CodePudding user response:

You this requirement to specific purposes, if a library table is stored library corresponding to the data of table 2 not to do any processing, then establish regular task execute the stored procedure can;
Stored procedures can be directly down again after 1 library 3 table data insert 2 3 tables in the library data;
If you just want by table 2 repository data changes to update the library data from table 1; So suggest use vernier match 1 library in the process of storage each row in a table of data consistency and 2 library, if inconsistent update; If you need an instance can stand inside letter contact

CodePudding user response:

DBlink, inside a stored procedure can operate on the table

CodePudding user response:

Table b data of the change, will not have time to record fields do,

You feel, this should increment is more suitable for

Full amount of simple truncate the insert with respect to ok, incremental through time column new data,
  • Related