-1

I'm beginner of pl/sql and I'm learning.

This is my table.

select * from s;

   SLNO ENAME                       SAL
------ -------------------- ----------
     1 Shiv                       8000
     2 Pankaj                     9000
     3 Prasath                   10000

This is my procedure:

set serveroutput on
create or replace procedure p1(n number)
is wname varchar(20);
begin
select ename into wname from s where eid=n;
dbms_output.put_line('------');
dbms_output.put_line('employee name:='||wname);
dbms_output.put_line('------');
end;

I'm getting a warning:

Procedure created with compilation errors.

If I execute the above query. Can anyone please suggest where I'm going wrong please..

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Shiv Patil
  • 1
  • 1
  • 1
  • 1
    Does it say what the compilation errors are? What happens if you try to execute the procedure after creating it? – David Jun 17 '13 at 14:52
  • 1
    It's hard to help you without knowing the details of the compilation error. One (probably unrelated) issue: you should be using `varchar2` instead of `varchar`: http://stackoverflow.com/questions/1171196/what-is-the-difference-between-varchar-and-varchar2 ...or if you want to do something really "cool", replace `wname varchar(20);` with `wname s.ename%type;` to ensure that `wname` will always be whatever type your column is. – FrustratedWithFormsDesigner Jun 17 '13 at 17:38
  • 1
    Show warnings and errors as described here: http://stackoverflow.com/questions/17013487/display-pl-sql-function-warnings/17013844#17013844 – Toru Jun 17 '13 at 19:19
  • 2
    This is a boring syntax error question and the OP has shown no inclination to requests for further information. So, voting to close. – APC Jun 18 '13 at 12:02

4 Answers4

3

You can use the following command.

show errors procedure procedure_name;

to get the list of errors and check that.

Sulthan Allaudeen
  • 11,330
  • 12
  • 48
  • 63
rathan
  • 31
  • 2
0

There is no column named EID on your table S.

0

put parameter type IN. Give procedure like create or replace procedure p1(n IN s.eid%TYPE)

It will work.

plsql
  • 1
0

I think there's a typo in your program, try

SET SETVEROUTPUT ON

all in capitals.

  • it worked for me. even i did not care about case, but when case was capital, it worked for me. same applies to creating triggers.(tried, tested and successful) Cheers – Hash Tang Oct 20 '15 at 17:23