Create Table table8_prc (
Family VARCHAR2(200),
Name VARCHAR2(200) ,
ID INTEGER
) ;
CREATE SEQUENCE ID_seq1
MINVALUE 1
START WITH 1
INCREMENT BY 1
CACHE 20;
Create or Replace trigger trg1
BEFORE insert on table8_prc
for each row
BEGIN
select ID_seq1.nextval INTO :new.ID from dual ;
END ;
CREATE OR REPLACE PROCEDURE addnewmem1 (str IN VARCHAR2)
AS
BEGIN
INSERT INTO table8_prc (Name, Family)
WITH
temp
AS
( SELECT REGEXP_SUBSTR (str,
'[^,]+',
1,
LEVEL) val
FROM DUAL
CONNECT BY LEVEL <= REGEXP_COUNT (str, ',') + 1)
SELECT TRIM (SUBSTR (val, 1, INSTR (val, ';') - 1)),
TRIM (SUBSTR (val, INSTR (val, ';') + 1))
FROM temp;
COMMIT;
END;
BEGIN
addnewmem1 ('faezeh;Ghanbarian,pari;izadi');
END;
BEGIN
addnewmem1 ('Saeed;Izadi,Saman; Rostami');
END;
select *
from table8_prc ;
1条答案
按热度按时间vxf3dgd41#
传递
ID
值并删除由其标识的行: