+ All Categories
Home > Documents > Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

Date post: 23-Dec-2015
Category:
Upload: kunalmalhotra
View: 277 times
Download: 22 times
Share this document with a friend
Description:
Wipro plsql
7
Wipro Freshers Training Programme Search Friday, 19 August 2011 SAMPLE PL/SQL ASSIGNMENTS PL/SQL Anonymous Block 1. Write a PL/SQL block that selects the maximum department number in the department table and store it in a SQL*PLUS variable. And print the results to screen. 2. Create a PL/SQL block to insert a new department number into the Departments table. Use maximum dept number fetched from above and adds 10 to it. Use SQL*PLUS substitution variable for department name. Leave the location AS null. 3. Create a PL/SQL block to update the location for an existing department. Use substitution variable for dept no. and dept location. 4. Create a PL/SQL Block to delete the department created in exercise 2. Print to the screen the number of rows affected. 5. 1. Write a PL/SQL block which accepts employee name, basic and should display Employee name, PF and net salary. HRA=31% of basic salary DA=15% of basic salary Net salary=basic+HRA+DAPF If the basic is less than 3000 PF is 5% of basic salary. If the basic is between 3000 and 5000 PF is 7% of basic salary. If the basic is between 5000 and 8000 PF is 8% of basic salary. 6. Write a PL/SQL block to find the salary grade of the specified employee. If grade is 1 display ‘the employee is junior engineer’ If grade is 2 display ‘the employee is engineer’ If grade is 3 display ‘the employee is lead engineer’ If grade is 4 display ‘the employee is Manager’ If grade is 5 display ‘the employee is Project manager’ (Use case expression) 7. Wrtie a PL/SQL block to award an employee with the bonus. Bonus is 15% of commission drawn by the employee. If the employee does not earn any commission then display a message that ‘employee does not earn any commission’. Otherwise add bonus to the salary of the employee. The block should accept an input for the employee number. 8. Write a PL/SQL block which displays the department name, total no of employees in the department, avg salary of the employees in the department for all the departments from department 10 to department 40 in the Dept table.If no employees are working in the department ,then display a message that no emplyees are working in that department. 9 .Write a PL/SQL block which accepts employee number and finds the average salary of the employees working in the department where that employee works. Google+ Followers Yes No Vote Show results Votes so far: 59 Days left to vote: 21 Is this blog Helpfull ? Share this on Facebook Tweet this View stats (NEW) Appointment gadget >> Share it Learn Java for Android Development Android Application Developer 2014 (1) 2013 (1) 2012 (5) 2011 (15) September (1) August (14) FRP UNIX Sample Questions with Answers FRP Questions for practice FRP UNIX PAPER 2 SAMPLE QUESTION WITH ANSWERS C Programs during trng Sample PRP Questions FRP SAMPLE QUESTIONS WITH ANSWERS Sample C Programs for FRP SAMPLE PL/SQL ASSIGNMENTS SAMPLE SQL ASSIGNMENTS DURING TRAINING Training Process Flow in Wipro FRP C AND DataStructure QUESTIONS JAVA PRP IMPORTANT QUESTIONS C PROGRAM TO DRAW THE MAP OF INDIA ADVANCE HAP... US downgrade not to impact Indian IT cos including... Blog Archive Total Pageviews 0 More Next Blog» Create Blog Sign In
Transcript
Page 1: Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

3/24/2015 Wipro Freshers Training Programme: SAMPLE PL/SQL ASSIGNMENTS

http://wiprotraining.blogspot.in/2011/08/sampleplsqlassignments.html 1/7

Wipro Freshers TrainingProgramme

Search

Friday, 19 August 2011

SAMPLE PL/SQL ASSIGNMENTS

PL/SQL

Anonymous Block

1. Write a PL/SQL block that selects the maximum department number in the department table andstore it in a SQL*PLUS variable. And print the results to screen.

2. Create a PL/SQL block to insert a new department number into the Departments table. Usemaximum dept number fetched from above and adds 10 to it. Use SQL*PLUS substitution variable fordepartment name. Leave the location AS null.

3. Create a PL/SQL block to update the location for an existing department. Use substitution variablefor dept no. and dept location.

4. Create a PL/SQL Block to delete the department created in exercise 2. Print to the screen thenumber of rows affected.

5. 1. Write a PL/SQL block which accepts employee name, basic and should displayEmployee name, PF and net salary.HRA=31% of basic salaryDA=15% of basic salaryNet salary=basic+HRA+DAPF

If the basic is less than 3000 PF is 5% of basic salary.If the basic is between 3000 and 5000 PF is 7% of basic salary.If the basic is between 5000 and 8000 PF is 8% of basic salary.

6. Write a PL/SQL block to find the salary grade of the specified employee. If grade is 1 display ‘the employee is junior engineer’ If grade is 2 display ‘the employee is engineer’ If grade is 3 display ‘the employee is lead engineer’ If grade is 4 display ‘the employee is Manager’ If grade is 5 display ‘the employee is Project manager’(Use case expression)

7. Wrtie a PL/SQL block to award an employee with the bonus.Bonus is 15% of commission drawn by the employee. If the employee does not earn any commissionthen display a message that ‘employee does not earn any commission’. Otherwise add bonus to thesalary of the employee. The block should accept an input for the employee number.

8. Write a PL/SQL block which displays the department name, total no of employees in thedepartment, avg salary of the employees in the department for all the departments from department10 to department 40 in the Dept table.If no employees are working in the department ,then display amessage that no emplyees are working in that department.

9 .Write a PL/SQL block which accepts employee number and finds the average salary of theemployees working in the department where that employee works.

Google+ Followers

YesNo

Vote Show results

Votes so far: 59 Days left to vote: 21

Is this blog Helpfull ?

Share this on Facebook

Tweet this

View stats

(NEW) Appointment gadget >>

Share it

Learn Java for Android Development

Android Application Developer

2014 (1)

2013 (1)

2012 (5)

2011 (15) September (1)

August (14)FRP UNIX Sample Questions with

Answers

FRP Questions for practice

FRP UNIX PAPER 2 SAMPLEQUESTION WITH ANSWERS

C Programs during trng

Sample PRP Questions

FRP SAMPLE QUESTIONS WITHANSWERS

Sample C Programs for FRP

SAMPLE PL/SQL ASSIGNMENTS

SAMPLE SQL ASSIGNMENTS DURINGTRAINING

Training Process Flow in Wipro

FRP C AND DataStructure QUESTIONS

JAVA PRP IMPORTANT QUESTIONS

C PROGRAM TO DRAW THE MAP OFINDIA ADVANCE HAP...

US downgrade not to impact Indian ITcos including...

Blog Archive

Total Pageviews

0 More Next Blog» Create Blog Sign In

Page 2: Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

3/24/2015 Wipro Freshers Training Programme: SAMPLE PL/SQL ASSIGNMENTS

http://wiprotraining.blogspot.in/2011/08/sampleplsqlassignments.html 2/7

If his salary is more than the average salary of his department, then display message that‘employee’s salary is more than average salary’ else display ‘employee’s salary is less than averagesalary’

Procedures and functions

1. Create a procedure that deletes rows from the emptable. It should accept 1 parameter, job; only delete theemployee’s with that job. Display how many employees weredeleted. Write a PL/SQL block to invoke the procedure.

2. Change the above procedure so that it returns the number ofemployees removed via an OUT parameter. Write a PL/SQL blockto invoke the procedure and display how many employeesWere deleted.

3. Convert the above program to a function. Instead of usingan OUT parameter for the number of employees deleted, usethe functions return value. Write a program to invoke thefunction and display how many employees were deleted.

4. Create a table having the following structureAccounts(Account_id, branch_name, amount_balance) a. Write a PL/SQL procedure to perform withdraw operation that only permits a withdrawal ifthere sufficient funds in the account. The procedure should take Account_id and withdrawal amountas input. b. Write a procedure to deposit money into someone's account. The procedure should acceptaccount_id and deposit amount. c. Write a procedure to transfer money from one person's account to another. The procedureshould table two account_id’s one for giver and one for receiver and the amount to be transferred.

Cursors and Data Types as in 3GL

1. Write a PL/SQL block to accept an employee number. and use a record variable to store the recordof that employee. and insert it into retired_employee table.Retired_employee table has the following structureRetired_employee (empno, ename, hiredate, leaveDate, salary, mgr_id, deptno).Set the leavedate to the current date.

2. Write a PL/SQL Block to create a PL/SQL table which can store grade and on of employees withthat grade. Get the information about the grade and number of employees with that grade and storeit in the PL/SQL table. Then retrieve the information from the PL/SQL table and display it on thescreen in the following way.No of employees with the grade 1 are 3No of employees with the grade 2 are 2No of employees with the grade 3 are 1No of employees with the grade 4 are 2No of employees with the grade 5 are 5

Cursors

1. Write a program that gives all employees in department 10 a15% pay increase. Display a message displaying how manyEmployees were awarded the increase.

2. Write a PL/SQL block and use cursor to retrieve the details of the employees with grade 5.and thendisplay employee no,job_id ,max_sal and min_sal and grade for all these employees.

3. Write a PL/SQL block that copies all departments to a tablecalled old_dept. Do not use a cursor FOR loop. Displayhow many rows were copied.

4. Display the names of employees who are working for Department 30.

5. Write a PL/SQL Block that mimics selecting all columns and rowsfrom the dept table. There is no need to format the output,

4 6 7 8 5

Join this sitewith Google Friend Connect

Members (5)

Already a member? Sign in

Followers

Administrator

Karthikeyan

Contributors

Page 3: Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

3/24/2015 Wipro Freshers Training Programme: SAMPLE PL/SQL ASSIGNMENTS

http://wiprotraining.blogspot.in/2011/08/sampleplsqlassignments.html 3/7

just select all columns and all rows. Use a cursor FOR loop.

6. Write a PL/SQL block to display the top 6 employees with respect to salaries using cursors.

7. Use a cursor to retrieve the department number and the department name from the dept table.Pass the department number to another cursor to retrieve from the emp table the details ofemployee name, job, hiredate and salary of all the employees who work in that department.

8.Write a procedure Raise_salary which gives a specified hike to all the employees working in aspecified department.The procedure should take department number and percemtage of hike asinput.(Use for update and where current of)

Exception Handling

1. Write a PL/SQL block to select the name of the employee with a given salary value.If the salary entered returns more than one row,Handle the exception with an appropriate exceptionhandler and insert into SALARY_MESSAGES table the message “more than one employee with asalary of <salary>”If the salary entered does not return any rows ,handle the exceptionWith an appropriate exception handler and and insert into the SALARY_MESSAGES table themessage “no employee with a salary of <salary>”If the salary entered returns only one row,insert into the SALARY_MESSAGES table ,the emloyee’sname and the salary amount.Handle any other exception with an appropriate handler and insert into the SALARY_MESSAGES tablethe message “some other error occurred”.Test the block for a variety of test cases.

2. Write a PL/SQL block to remove a specified department from the department table. If there areemployees in that department, print a message to the user that the department cannot be removed.(Use pragma exception init)

3. Write a PL/SQL program to update the salary and Department number in the employeestable using SQL*Plus bind variables (or initialized local variables if you prefer). Include the followingexception handling capabilities: Define, raise and handle an exception for salary values not in the range of 800 to 5000. Define and associate (EXCEPTION_INIT) and exception with the referential integrity constraintviolated system exception (2291) and use it to handle attempts to set the deptno to avalue not found in the Department table. Provide simple error handling for any other exceptions

Packages

Read the following specification:

Develop a package that will act as an API (Application Programming Interface) for the items table.We need to protect our data and want to ensure no one writes any code that will directly Access thistable.

Here is the structure of the items table:

Column Data Type Descriptionitem_id NUMBER Internal ID for itemitem_number VARCHAR2(10) User item numberdescription VARCHAR2(30) Item descriptionstatus VARCHAR2(1) [T]est or [L]iveCost NUMBER Standard cost of item

We need the item_id column to be a sequential number (useitems_item_id_s sequence)

The following business rules must be applied:• An item is created as a test item and with a zero cost.• A procedure or function must be called to promote the item from testto live. An item cannot be made live with a zero cost.• Only test items can be removed

We need an API to provide the developer the following facilities:• Create new items

Page 4: Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

3/24/2015 Wipro Freshers Training Programme: SAMPLE PL/SQL ASSIGNMENTS

http://wiprotraining.blogspot.in/2011/08/sampleplsqlassignments.html 4/7

Posted by Karthikeyan

Reactions: funny (0) interesting (1) cool (0)

• Promote items from test to live• Remove items• Change item costAll API functions and procedures should work with the item_id.

Create a package to implement the above. Remember, try andwork out the requirements for the package first. Determine yourpublic and private procedures/functions and any data that mightBe needed.

Triggers

1. To compliment the package developed in the last section, the userhas come up with the following addition to the specification.Implement the above specification using triggers.When items are removed using the new API you provided, we need toensure the item is archived in a table called items_archive.We also want any changes in item cost to be audited, record the detailsof each change in the auditing_cost table.

2. An HR system has an emp table that holds a row for each employee within the company. Eachrecord in the table has a manager field, (mgr) that holds the id for the employee's manager. Write atrigger so that when a manager record is deleted, the mgr field of that manager's employees is set toNULL. In other words, implement the following SQL statement:

WHEN AN EMPLOYEE IS DELETED, UPDATE employee SET mgr = null WHERE mgr = employee id of the deleted employee

3. Create one additional table job_salary having columnsJob_salary(job,min_sal,max_sal)And insert following records into the table.

('CLERK', 800, 1300);('ANALYST', 3000, 3500);('SALESMAN', 1250, 1600);('MANAGER', 2450, 2975);('PRESIDENT', 5000, 5500);

Write a trigger on emp table so that when a new employee record is inserted or updated and If thenew salary has been decreased or does not lie within the salary range for that job or if more than10% hike is given, then it should raise exceptions for these three cases mentioned above. Andtrigger should be executed for employees other than the president.

4. Write a trigger on the table job_salary so that when a record is deleted or updated from this table,the trigger should fire and has to check whether employees having the deleted job exist. If yes, itshould raise an exception. and if it is updation, and if there are employees in the emp table whosesalary does not lie within the modified range, then restore old salary ranges.

Recommend this on Google

Replies

27 comments:

Parag Deshmukh 26 October 2013 at 01:40

any 1 having solution of these questions...?

Reply

Prasanna Suri 12 March 2014 at 18:04

i have all the ans with me but how could i share them here

Karthikeyan 12 March 2014 at 23:12

Page 5: Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

3/24/2015 Wipro Freshers Training Programme: SAMPLE PL/SQL ASSIGNMENTS

http://wiprotraining.blogspot.in/2011/08/sampleplsqlassignments.html 5/7

Reply

Send the answers to [email protected]'ll post it on this website...

Thanks Administrator

Karthikeyan 12 March 2014 at 23:12

Send the answers to [email protected]'ll post it on this website...

Thanks Administrator

Prasanna Suri 13 March 2014 at 10:44

Hi Karthi, i have sent the answers to the given email address.Pls post them here.

Thanks,Suri

Saravanan Elangovan 13 March 2014 at 17:29

please send the answers to my mail id [email protected]

Prasanna Suri 13 March 2014 at 17:41

Hi Sarvanan,I have forwarded the doc please check.

Thanks,Suri

dipankar saikia 13 April 2014 at 21:15

can anyone send me answers only procedures and functions..please mailme..."[email protected]" i need your help please

Tammewar Sumeeth 23 May 2014 at 20:35

This comment has been removed by the author.

Arpan Gupta 27 May 2014 at 11:20

HI Prassanna ,

please send the answers to mail id [email protected]

thanks in advance!!

Akhil Chadha 10 February 2015 at 17:35

send the answers to [email protected] asap!!

Balvir Jha 1 November 2013 at 23:25

yes...but it is available at $10.

Reply

kaustubh chaudhary 20 March 2014 at 13:47

please send the answer to my mail id [email protected]

Reply

kaustubh chaudhary 20 March 2014 at 13:49

hi prasant suri....if u have the answer then please send mi on my emailkaustubh.jeindia@gmailcom

Reply

Mhlongo Dzonga 25 March 2014 at 19:30

Can anyone please send me answers at [email protected]

Reply

sarath kumar 30 March 2014 at 17:49

can any one send tome answers [email protected]

Page 6: Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

3/24/2015 Wipro Freshers Training Programme: SAMPLE PL/SQL ASSIGNMENTS

http://wiprotraining.blogspot.in/2011/08/sampleplsqlassignments.html 6/7

Replies

Reply

Reply

sarath kumar 30 March 2014 at 17:55

Hi Prasanna i developed some assignments i want to check my quries can u send answers [email protected]

Reply

Tamil Selvi 12 April 2014 at 21:49

hi frnds...pls send assignment answers

Reply

Naveen Rai 16 April 2014 at 12:16

can you please Send the answers to [email protected].

Reply

Prasanna Suri 16 April 2014 at 14:48

Guys ans have been sent to all the email id's provided here.please forward them to whoever need it.

Reply

Karthikeyan 16 April 2014 at 23:16

Hi All,

As per your request i posted the answers as a post.Link : http://wiprotraining.blogspot.in/2014/04/sampleplsqlassignmentsanswers.html

Reply

Prasanna Suri 17 April 2014 at 12:10

Hi Karthi,

Thanks for posting the answers here. This will help .

Unknown 23 May 2014 at 06:30

Very useful... Thanks a lot :)

Reply

ARITRA SADHU 19 February 2015 at 11:22

please send me the answersmail id: [email protected]

Reply

reem 20 March 2015 at 14:31

please send the [email protected]

Reply

vinoth kumar 22 March 2015 at 19:25

Reply

This comment has been removed by the author.

vinoth kumar 22 March 2015 at 19:27

please send the answers to my mail id [email protected]

Reply

Page 7: Wipro Freshers Training Programme_ SAMPLE PL_SQL ASSIGNMENTS

3/24/2015 Wipro Freshers Training Programme: SAMPLE PL/SQL ASSIGNMENTS

http://wiprotraining.blogspot.in/2011/08/sampleplsqlassignments.html 7/7

Newer Post Older PostHome

Subscribe to: Post Comments (Atom)

Enter your comment...

Comment as: Google Account

Publish Preview

Simple template. Powered by Blogger.


Recommended