Preview

Pl/Sql Programs

Good Essays
Open Document
Open Document
1293 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Pl/Sql Programs
3

Section-B(PL/SQL)
16. Write a Pl/Sql program to raise the employee salary by 30%, who have completed their 40 years of service. declare cursor c3 is select * from emp where extract(year from sysdate)-extract(year from hiredate)>40 for update; e emp%rowtype; begin open c3; loop fetch c3 into e; exit when c3%notfound; update emp set sal=e.sal+(30/100)*e.sal where current of c3; end loop; close c3; end; / 17. Write a Pl/Sql program to check the given number is Armstrong ‘or’ not. declare n number(3); s number(3):=0; t number(3); begin n:=&n; t:=n; while t>0 loop s:=s+power((t mod 10),3); t:=trunc(t/10); end loop; if(s=n) then dbms_output.put_line('The given number ' || n || 'is an armstrong number'); else dbms_output.put_line('The given number ' || n || 'is not an armstrong number'); end if; end; / 18. Write a Pl/Sql program to display top 10 rows in emp table based on their job and salary. declare cursor c1 is select * from emp order by sal desc; e emp%rowtype; begin
IIMC Prashanth Kuma r K (Head-Dept of Compute rs)

4

open c1; loop fetch c1 into e; exit when c1%rowcount=11 or c1%notfound; dbms_output.put_line('top ::'||c1%rowcount||' employee'); dbms_output.put_line('employee no:'||e.empno); dbms_output.put_line('employee name'||e.ename); dbms_output.put_line('employee job is '||e.job); dbms_output.put_line('employee salary is '||e.sal); dbms_output.put_line('*-*-*-*-*-*-*-*-*-*-*-*-*-*'); end loop; end; / 19. Write a Pl/Sql program to swap two numbers without using third variable. declare a number(3); b number(3); begin a:=&a; b:=&b; dbms_output.put_line('before swapping a= '||a||' and b= '||b); a:=a+b; b:=a-b; a:=a-b; dbms_output.put_line('after swapping a= '||a||' and b= '||b); end; / 20. The hrd manager has decided to raise the employee salary by 20%. Write a Pl/Sql block to accept the employee number and update the salary of that employee. Display appropriate message based on the existence of the record in emp table. declare e emp%rowtype; no

You May Also Find These Documents Helpful

  • Good Essays

    Each of the department’s data are collected from different sources, some data is stored on hard copies that need to be reentered into the other system so that it is digitally available, which other branches are currently using. As a result of all the time it takes to transfer all existing data currently on hard copy, a lot of manpower hours are being wasted during this process. With the use of multiple codes on the many business systems that are currently in place, data needs to be converted to the proper code before each system can recognize the data. The above mentioned two issues, data that is hard copied and multiple code issues, is translated to losing a portion of the company’s profit margin because of the excess man-hours that are spent on the two issues. A good example of both issues that the income and balance sheets are labor intensive and will be completed 15-20 days after the month has ended. Since there is a lot of manpower required to complete the income and balance sheets, there needed to be a solution to try and resolve the large amounts of man-hours wasted completing these…

    • 884 Words
    • 4 Pages
    Good Essays
  • Good Essays

    CH 11 12 13 DIAGRAM

    • 351 Words
    • 2 Pages

    Consider the situation shown in the table and Figure 10.2 (above). The total revenue earned by the production of 4 workers is $_____________ . 102…

    • 351 Words
    • 2 Pages
    Good Essays
  • Good Essays

    PRG/420 Week 3

    • 1025 Words
    • 5 Pages

    Scanner; /* * @author * Week 3 Individual Assignment * Assignment: Simple Commission Calculation Project Part 2 * Due Date: */ public class AnnualCompensationCalculator { /** * main method begins program execution */ public static void main(String args[]) { String firstName; // Get user 's first name String lastName; // Get user 's last name int salary; // User 's fixed annual salary double commissionRate; // User 's commission rate double sales; // User 's annual sales double totalCommission; // User 's total commission earned double totalCompensation; //…

    • 1025 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Mis562 Week 2

    • 2131 Words
    • 9 Pages

    3. SQL> --3. Repeat exercise 2 for any employee that is not a manager or earns a salary > $1,000…

    • 2131 Words
    • 9 Pages
    Satisfactory Essays
  • Good Essays

    Programing Problems

    • 721 Words
    • 3 Pages

    As Real Declare NetPay As Real Display “Welcome to Wage Calculator” Display “Please enter all information carefully” Call User Input Module Call Gross Pay Module Call Tax Module Call Net Pay Module Call Display Module End Main Module User Input Module Display “Please enter Employee ID number” Input EmployeeID Display “Please enter hourly rate of pay” Input HourlyRate…

    • 721 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Week 5 Assignments New

    • 754 Words
    • 6 Pages

    3.) Design an if-then-else statement that assigns 0 to variable b if variable a is less than 10, otherwise it should assign 99 to variable b. (Alternative if statement)…

    • 754 Words
    • 6 Pages
    Satisfactory Essays
  • Satisfactory Essays

    In order to write this program, two variables, ROWNUM and COLUMNNUM, will be used with nested repetition loop to complete the necessary calculations. ROWNUM will be used in an outerloop and contain numbers between1-10 and COLUMNNUM will be used in an innerloop and contain numbers between 1-10. For each iteration of the outerloop, the inner loop will be executed 10 times and the product of ROWNUM*COLUMNNUM will produce the multiplication table of ROWNUM. The ROWNUM and COLUMNNUM variables will be incremented by 1in each iteration of loops. The new line will be printed to display the multiplication table for each value of ROWNUM in a separate line.…

    • 345 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Hospital and Square Feet

    • 389 Words
    • 2 Pages

    Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an in-patient or an outpatient. If the patient was an in-patient the following data should be entered: • The number of days spent in the hospital • The daily rate • Charges for hospital services (lab tests, etc.) • Hospital medication charges. If the patient was an out-patient the following data should be entered:…

    • 389 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Due date: 1 August 2012 NB: Make sure you select the correct unique number for your module from those indicated below. Unique number 759546 Tutorial matter covered in the prescribed book Chapters 1 - 3: Chapter 5: Chapter 6: Chapter 7: Chapter 12: Chapter 14: Chapter 16: Revise as for Assignment 01 Entity relationship modelling Advanced data modelling Normalisation of database tables Transaction management and concurrency control Distributed database management systems Database connectivity and web development…

    • 960 Words
    • 4 Pages
    Powerful Essays
  • Better Essays

    To help users of NonStop SQL/MP become familiar with the product's features, Tandem includes a sample database and sample application on the product site update tape (SUT). The sample database demonstrates the use of NonStop SQL/MP in a Pathway transaction processing environment. It includes several host language programs that use embedded SQL statements to access the sample database. Users can also access the sample database with SQLCI commands. The source code, database creation and load files, and installation instructions for the sample database and application are stored on a file named DOCUMENT on a subvolume named ZTSQLMSG when NonStop SQL/MP is installed. (The volume name is specified at installation time by the user who installs NonStop SQL/MP. To determine the volume name, check with the group that installs NonStop SQL/MP at your site.) If you set your volume default to the appropriate disk volume, you can use the following command to print the installation instructions:…

    • 20570 Words
    • 83 Pages
    Better Essays
  • Good Essays

    Capacity Decision

    • 530 Words
    • 3 Pages

    $ 50,000 ($25 X 2000) $ 3,000 $ 20,000 ($10 X 2000) $ 23,000 $ 27,000…

    • 530 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    4. Azrul starts with a monthly salary of RM 1300 for the first year and receives an annual increment of RM 70 .How much is his monthly salary for the nth year of service .How much will he receive monthly for his tenth year of service?…

    • 796 Words
    • 6 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Cse Cycle Sheet Programs

    • 384 Words
    • 2 Pages

    PROBLEM STATEMENT All the Programs Must be Implemented in C Programming Language Only Write a Program to Display your details in the following format. ******************************* | Name : XXXXXXXX | | Age : XX | | Register Num : XXXXXXXX | | School : XXXXXXXX | ******************************** Write a Program to get Phone number (Integer), Age (Integer), Height (Decimal), Sex (Single character ‐ ‘M’ or ‘F’) from the user and then display the details. Write a Program to Exchange values in two integer variables i) Using a Temporary Variable ii) Without using a Temporary Variable Write a Program to perform basic Arithmetic operations which are Addition, Subtraction, Multiplication, Division and Modulo of Two numbers. Numbers are assumed to be Integers and has to be inputted from the user.…

    • 384 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    ­ DIFFERENCE (diff between two strings ­ return 4 represents no diff or strong similarity)…

    • 1253 Words
    • 6 Pages
    Powerful Essays
  • Satisfactory Essays

    oracle

    • 3885 Words
    • 16 Pages

    ORACLE 10g ASM May 17th, 2006 Inderpal S. Johal Principal Consultant Agenda What is ASM Benefits of ASM ASM Architecture ASM Components DB Instance parameters to support ASM ASM Instance Monitoring using EM ASM Views Migrating from File system to ASM Miscellaneous Tips Q&A Data Softech Inc. Oracle 10g ASM 2 What is ASM ASM stands for Automatic Storage Management It is Oracle Cluster File System and Volume Manager Designed for Oracle Database Related Files…

    • 3885 Words
    • 16 Pages
    Satisfactory Essays

Related Topics