We help IT Professionals succeed at work.

creating procedure with no parameters pl/sql

casit
casit asked
on
741 Views
Last Modified: 2013-12-18
Hello I'm trying to create the following procedure but it keeps on giving me an error.

[error]
Error(2,31): PLS-00103: Encountered the symbol ")" when expecting one of the following:     <an identifier> <a double-quoted delimited-identifier>    current
[/error]
create or replace
PROCEDURE       CHECK_AVG_SAL()
 CURSOR emp_cursor() IS
        SELECT e.employee_id, (j.max_salary + j.min_salary)/2 as avg_sal, e.salary 
        FROM employees e, jobs j WHERE j.job_id = e.job_id FOR UPDATE NOWAIT;	
         emp_record employees%rowtype;
IS
 
BEGIN
     
    for emp_record in emp_cursor() loop
          /*EXIT WHEN statement*/
          EXIT WHEN emp_cursor%NOTFOUND;
          if emp_record.salary > emp_record.avg_sal THEN
          UPDATE EMPLOYEES SET SAL_LIMIT_INDICATE = 'YES' WHERE EMPLOYEE_ID = emp_record.employee_id
          ELSE
          UPDATE EMPLOYEES SET SAL_LIMIT_INDICATE = 'NO' WHERE EMPLOYEE_ID = emp_record.employee_id
          END IF;
      END LOOP;  
	  IF emp_cursor%ISOPEN THEN
		CLOSE emp_cursor;
	  END IF;
END;

Open in new window

Comment
Watch Question

Geert GOracle dba
CERTIFIED EXPERT
Top Expert 2009

Commented:
there is no need to put () after a procedure
if you don't suplly any params then don't put ()

this isn't C
Oracle dba
CERTIFIED EXPERT
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Now I'm getting this error

Error(3,2): PLS-00103: Encountered the symbol "CURSOR" when expecting one of the following:     ( ; is with authid as cluster compress order using compiled    wrapped external deterministic parallel_enable pipelined

Author

Commented:
nm I figured it all out.
Geert GOracle dba
CERTIFIED EXPERT
Top Expert 2009

Commented:
do not put () where there is no parameters

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.