Categories
Uncategorized

Pl/sql query(cIA5)

1. Create a PL/SQL block that selects the maximum department number in the DEPARTMENTS table and stores it in a variable. Print the results to the screen.

Solution,

declare
V_max department.deptno%type;
begin
select max(deptno)
into V_max from department;
dbms_Output.put_line(V_max);
end;
/

3. Write a PL/SQL block which accepts employee name, basic and should displayEmployee name, PF and net salary.

HRA=30% of basic salary

DA=75% of basic salary

Net salary=basic+HRA+DA-PF

If the basic is less than 8000 PF is 5% of basic salary.

If the basic is between 8000 and 15000 PF is 7% of basic salary.

If the basic is between 15000 and above PF is 8% of basic salary.

solution,

declare
V_name employee.name%type;
V_salary employee.salary%type;
da number;
hra number;
pf number;
netsalary number;
begin
select name,salary into V_name,V_salary from employee where name=&V_name;
da:=0.75*v_salary;
hra:=0.3*V_salary;
case
when V_salary<8000
then
pf:=V_salary * (5/100);
when V_salary between 8000 and 15000
then
pf:=V_salary * (7/100);
when V_salary>15000
then
pf:=V_salary* (8/100);
end case;
netsalary:=V_salary+ da + hra -pf;
dbms_output.put_line(‘The pf and Netsalary for ‘||V_name||’ is ‘||pf||’ and ‘||netsalary||’ ‘);
exception
when NO_DATA_FOUND then
dbms_output.put_line(’employee donot exists’);
end;
/

12 replies on “Pl/sql query(cIA5)”

Hello my family member! I wish to point out that this post is amazing,
nice written and include approximately all important infos.
I’d like to peer extra posts this way .

Admiring the dedication you put into your website and detailed information you offer.
It’s great to come across a blog every once in a while that isn’t the
same unwanted rehashed material. Wonderful read! I’ve bookmarked your site and I’m adding your
RSS feeds to my Google account.

I don’t even be aware of way I finished up here, however I figured this publish was once great.
I do not understand who you happen to be however certainly you’re attending a famous blogger if
you happen to are not already. Cheers!

Great post. I was once checking continuously this weblog and I’m inspired!
Very helpful information specially the final section :
) I deal with such info a great deal. I used to be seeking this certain info to get a very long time.
Thanks and have a great time.

I just want to tell you that I’m all new to blogging and site-building and definitely loved this blog. Probably I’m likely to bookmark your blog post . You actually have wonderful article content. Thanks a lot for sharing your blog site.

I just want to say I am just all new to blogs and certainly savored you’re web-site. Likely I’m planning to bookmark your site . You definitely have perfect writings. Kudos for sharing with us your website page.

I know this if off topic but I’m looking into starting my own weblog
and was wondering what all is needed to get setup?

I’m assuming having a blog like yours would cost a pretty
penny? I’m not very web savvy so I’m not 100%
sure. Any suggestions or advice would be greatly appreciated.

Thanks

Comments are closed.