Write a PL/SQL block to find out the start date for current job of a specific employee
- pl/sql
- 2021-09-28
- mhanasmh00489829403
الأجوبة
DECLARE
emp_st_date DATE;
wr_emp_id employees.employee_id%TYPE := &enter_employee_id;
BEGIN
SELECT Max(end_date) + 1
INTO emp_st_date
FROM job_history
WHERE employee_id = wr_emp_id;
IF emp_st_date IS NULL THEN
SELECT hire_date
INTO emp_st_date
FROM employees
WHERE employee_id = wr_emp_id;
END IF;
dbms_output.Put_line('----------------------------------------------------------------------');
dbms_output.Put_line('The starting date of current job for the employee '
||wr_emp_id
||' is: '
||emp_st_date);
END;
/
Sample Output:
SQL> / Enter value for enter_employee_id: 189 old 3: wr_emp_id employees.employee_id%TYPE := &enter_employee_id; new 3: wr_emp_id employees.employee_id%TYPE := 189; ---------------------------------------------------------------------- The starting date of current job for the employee 189 is: 13-AUG-05 PL/SQL procedure successfully completed.
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة