Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using IN OUT parameter in procedures

GTS (DBA)Aug 2 2013 — edited Aug 3 2013

Hello Experts ;


Good morning all;


i am trying to  execute a program using procedure ( IN and IN OUT ) parameter.

i have a emp table i want to update perk  column details.


>> Here is coding >>


1  create or replace procedure emp_salary

  2  (id IN emp.eid%type , salary IN OUT emp.esalary%type) IS

  3  tmp_sal number;

  4  BEGIN

  5  select esalary into tmp_sal from emp  where eid=id;

  6  if tmp_sal between 10000 and 20000 THEN

  7  salary_inout := tmp_sal*1.2;

  8  else if tmp_sal between 20001 and 29999 THEN

  9  salary_inout := tmp_sal*1.8;

10  ELS IF tmp_sal > 30000 then

11  salary_inout := tmp_sal*2.0;

12* END;

SQL> /

Warning: Procedure created with compilation errors.

SQL> show errors;

Errors for PROCEDURE EMP_SALARY:

LINE/COL ERROR

-------- -----------------------------------------------------------------

10/5     PLS-00103: Encountered the symbol "IF" when expecting one of the

           following:      := . ( @ % ;   The symbol ";" was substituted for "IF" to continue.

12/4     PLS-00103: Encountered the symbol ";" when expecting one of the

         following: if

MY DB version is : 10.2.0.1

emp details :


SQL> select * from emp;

|EID | ENAME  |  EQUAL |  ESALARY | ECITY     |  EPERK   |    

1    sona    |   mba  |  10000   | ********    |            |

2    maya   |   mca  |  15000   |  **********|            |

3    sony    |   msc   |  20000   |  ****         |            |

4    King    |   m.s   |  22000   |  **********|             |

5    ford     |   m.s   |  40000   | **********|              |

Thanks in advance ;

This post has been answered by Frank Kulash on Aug 3 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2013
Added on Aug 2 2013
11 comments
955 views