By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select * from V$VERSION;
BANNER | BANNER_FULL | BANNER_LEGACY | CON_ID |
---|---|---|---|
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production | Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production Version 18.4.0.0.0 |
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production | 0 |
create table shareholder(shareholder_id number(10) not null,
type varchar2(30) not null, constraint pk_sh_id primary key(shareholder_id))
create table direct_holder(direct_holder_id number(10) not null,
first_name varchar2(50),
last_name varchar2(50), constraint fk_dir_hd_id
FOREIGN KEY (direct_holder_id)
REFERENCES shareholder(shareholder_id))
CREATE SEQUENCE shareholder_id_seq
INCREMENT BY 1
START WITH 25;
CREATE OR REPLACE PROCEDURE insert_direct_holder(
p_first_name in direct_holder.first_name%type,
p_last_name in direct_holder.last_name%type)
IS
BEGIN
INSERT ALL
INTO SHAREHOLDER
(shareholder_id, type) values(shareholder_id_seq.nextval,'Direct_Holder')
INTO DIRECT_HOLDER
(direct_holder_id,first_name,last_name) values
(shareholder_id_seq.nextval,p_first_name,p_last_name)
SELECT 'DUMMY' FROM dual;
COMMIT;
END;
/
select * from user_Errors;
select * from shareholder;
select * from direct_holder;
begin
insert_direct_holder('My_first_name','My_last_name');
end;
/
1 rows affected
select * from shareholder;
SHAREHOLDER_ID | TYPE |
---|---|
25 | Direct_Holder |
select * from direct_holder;
DIRECT_HOLDER_ID | FIRST_NAME | LAST_NAME |
---|---|---|
25 | My_first_name | My_last_name |