Question: Please do the PL / SQL code this feature and put it inside a table also as a reference take my feature 2 just like
Please do the PLSQL code this feature and put it inside a table also as a reference take my feature just like how i did it
Feature : add a company. Input includes a company name. The procedure does the following:
It first checks whether there is a company with the same name as the input, if so prints a message 'company already exists' and stops.
If the company does not exist, it inserts a row into the company table with a newly generated company ID using sequence and the input company name. It also prints out the new vehicle ID Delete this before turning in
Drop existing table and cascade constraints
DROP TABLE company CASCADE CONSTRAINTS;
SET SERVEROUTPUT ON;
Create sequence for company IDs
CREATE SEQUENCE companySeq START WITH ;
Create company table
CREATE TABLE company
compID INT NOT NULL,
compName VARCHAR NOT NULL,
PRIMARY KEY compID
;
Create or replace the procedure for adding companies
CREATE OR REPLACE PROCEDURE addCompany
newcompName VARCHAR
AS
vcompid NUMBER;
BEGIN
BEGIN
SELECT compID INTO vcompid FROM company WHERE compName newcompName;
DBMSOUTPUT.PUTLINECompany already exists.;
EXCEPTION
WHEN NODATAFOUND THEN
SELECT companySeq.NEXTVAL INTO vcompid FROM DUAL;
INSERT INTO company compID compName
VALUES vcompid newcompName;
DBMSOUTPUT.PUTLINENew company ID: vcompid;
END;
END;
Regular Cases
BEGIN
addCompanyGoogle;
addCompanyAmazon;
addCompanyMeta;
END;
Select to verify entries
SELECT FROM company;
Special Cases
BEGIN
addCompanyGoogle;
addCompanyAmazon;
END;
Verfiy companies were not added
SELECT FROM company;
Feature : search for job posts. The input includes a keyword, job type full time or part time and a state. The procedure does the following:
It finds all job posts that are active and the job title or job description has a substring that matches the input keyword, and the job post's state and job type match the input state and job type. The procedure prints out the matching job posts' job post id associated company name, job title, description, min and max pay, city and state.
In case there are no matching job posts, print out No job posts found'.
Hint: to match a substring in the procedure, use
where columnname like inputkeyword
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
