CREATE OR REPLACE procedure sp_tab is
id1 number:=0;
begin
select nvl(max(id1), 0) + 1
into id1
from DUAL;
insert into table1
SELECT distinct id1, '', SUBSTR(PRODUCT, 0, INSTR(PRODUCT, ' ') - 1), ''
FROM table2
WHERE PRODUCT NOT IN ('proved product', 'sample', 'graphic era', 'asa');
end;
从表'table2'在表'table1'中插入id的Creatin过程 使用过程,但它显示匿名行为。
答案 0 :(得分:0)
创建如下序列:
create sequence id1 start with 1 increment by 1;
在您的代码中使用它,如下所示:
CREATE OR REPLACE PROCEDURE sp_tab
IS
BEGIN
INSERT INTO table1
SELECT id1.nextval,
'',
SUBSTR (PRODUCT, 0, INSTR (PRODUCT, ' ') - 1),
''
FROM table2
WHERE PRODUCT NOT IN ('proved product',
'sample',
'graphic era',
'asa');
END;