Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

alling a function from PL/SQL in a select statement in ORACLE

DECLARE
  em_sal NUMBER(20);
  em_comm employees.commission_pct%type;
  annual_salary NUMBER(10,4);
BEGIN
  SELECT salary INTO em_sal FROM employees WHERE employee_id=149;
  SELECT commission_pct INTO em_comm FROM employees WHERE employee_id=149;
  annual_salary := get_annual_comp(em_sal,em_comm);
  dbms_output.put_line('total salary '|| annual_salary);
  SELECT SUM(get_annual_comp(salary,commission_pct)) into annual_salary
  FROM employees
  WHERE department_id=90;
  dbms_output.put_line('department annual salary '|| annual_salary);
END;
/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #alling #function #select #statement #ORACLE
ADD COMMENT
Topic
Name
4+9 =