Question
1. Write a PL/SQL procedure called INSERT_DIRECT_OLDER which will be used to insert new direct holders. Create a sequence object on the database to automatically
1. Write a PL/SQL procedure called INSERT_DIRECT_OLDER which will be used to insert new direct holders. Create a sequence object on the database to automatically generate shareholder_ids. Use this sequence in your procedure.
-Input parameters: first_name, last_name
I tried implementing it but not sure if the code is right
CREATE OR SEQUENCE direct_holder_id_seq INCREMENT BY 1 START WITH 30;
CREATE OR REPLACE PROCEDURE INSERT_DIRECT_HOLDER ( p_direct_holder_id IN direct_holder.direct_holder_id %TYPE, p_first_name IN direct_holder.first_name%TYPE, p_last_name IN direct_holder.last_name%TYPE) AS BEGIN insert into direct_holder( direct_holder_id,first_name, last_name) values(direct_holder_id_seq.nextval, p_first_name, p_last_name); COMMIT; END; / show errors procedure INSERT_DIRECT_HOLDER;
EXEC INSERT_DIRECT_HOLDER(direct_holder_id_seq.nextval, 'Jane', 'Doe');
2. Write a PL/SQL procedure called INSERT_COMPANY which will be used to insert new companies. The stock_id for new companies will be null. Use the sequence object that you created in problem 1 to get new shareholder_ids.
-Input parameters: company_name, city, county
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started