更新时间:2022-12-03 23:07:41
您需要做的是创建一个过程,然后在该过程中声明一个 cursor 以及 variable_c_row cursor_name%ROWTYPE
.
What you will need to do is create a procedure, then within the procedure declare a cursor as well as a variable_c_row cursor_name%ROWTYPE
.
在程序中,这将是内容:
Within the procedure, this will be the contents:
OPEN cursor_name
FETCH cursor_name INTO variable_c_row;
WHILE cursor_name%FOUND LOOP
-- Declare a number variable (i)
i := 0;
-- Declare a varchar variable (match)
match := variable_c_row.col3
WHILE length(match) > 0 LOOP OR l_countryname IS NULL
begin
-- Declare a yourrow%ROWTYPE variable (l_countryname)
SELECT col4 FROM table2 INTO l_countryname WHERE col1 = match;
UPDATE table1 SET col12 = l_countryname;
exception when no_data_found then null;
end;
i := i+1;
match := substr(variable_c_row.cow3, 0, length(match)-i);
END LOOP;
FETCH cursor_name INTO variable_c_row;
END LOOP;
CLOSE cursor_name;
由于问题没有 DDL 或 DML,我最多只能提供一个广泛的答案,尚未经过测试.
Since the question had no DDL or DML, the most I can provide is a broad answer, which has not been tested.