Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE PROCEDURE PROC1 (IN V1 DECIMAL(8, 2), IN V2 DECIMAL(8, 2), OUT W DECIMAL(10,2) )
- P1: BEGIN
- -- #######################################################################
- -- # Returns count of tables created by DB2ADMIN and like VARNAME
- -- #######################################################################
- SET W = V1 + V2;
- END P1
- SELECT EMPNO, JOB, COMM
- FROM EMPLOYEE
- WHERE EMPNO NOT LIKE '%10';
- CREATE TABLE datatab
- (
- EMP_ID INTEGER,
- SAL DECIMAL(8,2)
- );
- CREATE TABLE SALARIES
- (
- EMP_ID INTEGER,
- SALARY DECIMAL(8,2),
- JOB VARCHAR(10)
- );
- INSERT INTO SALARIES(EMP_ID, SALARY, JOB)
- SELECT EMPNO, COMM, JOB FROM EMPLOYEE;
- -- 2000 do 3000
- UPDATE SALARIES
- SET SALARY = SALARY * 1.10
- WHERE SALARY BETWEEN 2000 AND 3000 AND JOB NOT LIKE 'PRES';
- -- ponizej 2000
- UPDATE SALARIES
- SET SALARY = SALARY * 1.15
- WHERE SALARY < 2000 AND JOB NOT LIKE 'PRES';
- -- powyzej 3000
- UPDATE SALARIES
- SET SALARY = SALARY * 1.05
- WHERE SALARY > 3000 AND JOB NOT LIKE 'PRES';
- SELECT e.EMPNO, e.JOB, e.COMM, d.SALARY FROM EMPLOYEE e, SALARIES d
- WHERE e.EMPNO = d.EMP_ID;
- SELECT * FROM SALARIES;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement