Question: correct the return error and show the output screen? CREATE TABLE EMP ( empid number(10) NOT NULL, empname varchar2(50) NOT NULL, departmentname varchar2(50) NOT NULL,

correct the return error and show the output screen?

CREATE TABLE EMP ( empid number(10) NOT NULL, empname varchar2(50) NOT NULL, departmentname varchar2(50) NOT NULL, job varchar2(50) NOT NULL, country varchar2(50) NOT NULL, salary number(10) NOT NULL );

* query for insert data inside table

insert into EMP values(100,"Olivia","Physics","Softaware","UK",400000); insert into EMP values(200,"Emma","Math","Account","India",200000); insert into EMP values(300,"Sophia","Chem","machanic","USA",300000); insert into EMP values(400,"Sam","bio","doctor","brazil",500000);

* query for the total find salaries of all employees who are working in ABC department or working as XYZ job or working in SDF country name.

select SUM(salary) from EMP where departmentname ="Physics" OR job = "Account" OR country = "USA";

--------------------------------------------------------------------------------------------------------------------------------------------------------

Now we have to use this query inside function:-

// function use for increase performance. // function always return value // three type of parameter use inside function IN ,OUT ,IN OUT

create or replace function AllSal(dep_name in VARCHAR2, job_name in VARCHAR2,country_name in VARCHAR2)

return integer as total_salaries integer:=0;

begin select SUM(salary) into total_salaries from EMP where departmentname =dep_name OR job = job _name OR country = country_name;

return total_salaries; end;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!