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!

Accepting user input in pl/sql procedure

DevguyAug 1 2011 — edited Aug 2 2011
Can someone kindly explain me how can i accept user input in the below stored procedure
CREATE OR REPLACE PROCEDURE calsal
IS
   CURSOR maxsal
   IS
      SELECT *
        FROM emp;

   max_sal   emp.sal%TYPE;
BEGIN
   SELECT MAX (sal)
     INTO max_sal
     FROM emp;

   FOR i IN maxsal
   LOOP
      IF i.sal = max_sal
      THEN
         DBMS_OUTPUT.put_line (   ' Maximum salary plus bonus of '
                               || i.empno
                               || ' is '
                               || (i.sal + i.sal * 0.5)
                              );
      END IF;
   END LOOP;
END;
The above program works fine,but if i want to keep a WHERE condition in line No 12 i.e., WHERE deptno:=&deptno..My logic doesn't work by just putting like this.So,anyone can explain me what should i do in order to accept department number from user.

Thanks in advance!!
This post has been answered by Solomon Yakobson on Aug 1 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2011
Added on Aug 1 2011
21 comments
6,426 views