Home > database >  Questions about Oracle stored procedures for loop, rookie urgent solution
Questions about Oracle stored procedures for loop, rookie urgent solution

Time:09-28

Now have two temporary table, table A article 25 data, table B 588 data, the goal is to the each of the data in table A and table B in each of the data into A new data in the table C, according to the truth, there should be 25 * 588=14700 data, because involves the callback is poor, so I used the cursor, and data, using A combination of double layer for loop to come out the result of always article 25 * 25 * 588=367500 data, how is this to return A responsibility excuse me?

CodePudding user response:

CodePudding user response:


As above two figure, USES a stored procedure call another stored procedure

CodePudding user response:

Select * from a, b this statement can generate article 25 * 588 to meet the requirements of your data

CodePudding user response:

Didn't understand what you mean, it is suggested that posted the full code

CodePudding user response:

Upstairs positive solution first, and only need to select * from a, b, it is concluded that the is the cartesian product of table a and table b,

And although didn't see you all of the code, but guess, your first store there is no problem, but the second time

Annotations in the control loop number, can think you are a cycle is to use the number below to control the end of the cycle, but you then wrote a for the cycle of the cursor, this shows that your second procedure has two loops, combined with the first of the stored procedure a loop, just 25 * 25 * 588=367500, article 25 of the data table if you said is FSOBRANCHD_T this form, it should be so true,

CodePudding user response:

reference 5 floor qq_38206656 reply:
upstairs first positive solution, only need to select * from a, b, that is a table and cartesian product of table b,

And although didn't see you all of the code, but guess, your first store there is no problem, but the second time

Annotations in the control loop number, can think you are a cycle is to use the number below to control the end of the cycle, but you then wrote a for the cycle of the cursor, this shows that your second procedure has two loops, combined with the first of the stored procedure a loop, just 25 * 25 * 588=367500, article 25 of the data table if you said is FSOBRANCHD_T this form, it should be so yes,

Second stored procedures in the control loop variables, is in the logic below made an if, else, and before the cursor open access, so that will have effect? thank you

CodePudding user response:

For policyCur policyCursor in loop is a loop, and it is control cycles of that kind of, the number is policyCuersor store data rows,
If you judge what is else? V_count FSOBRANCHD_T is the size of the number of rows and rows of policyCuersor is a value, not a repeated
To whether I understand that I posted all of the code,

CodePudding user response:

Few data volume, still doing write cycle, direct insert,
Insert into C table select here writing table A and table B, the corresponding fields, order to agree and C table field, each field commas, from A table, table B;
commit;

CodePudding user response:

Insert A table b table data into the new table with the trigger point
  • Related