Home » SQL & PL/SQL » SQL & PL/SQL » Help in PROCEDURE
Help in PROCEDURE [message #438175] Thu, 07 January 2010 06:14 Go to next message
breakid
Messages: 6
Registered: January 2010
Location: IL
Junior Member
Hi I am building a PROCEDURE that will add a worker ro my data base
CREATE TABLE Worker (
    Name           VARCHAR2(20) NOT NULL,
    Salary         NUMBER(38) NOT NULL CHECK(Salary>0),
    unionnum       NUMBER(38) NOT NULL,
    ID             NUMBER(38) NOT NULL,
 CONSTRAINT pk_Worker PRIMARY KEY (ID));

this is the procdure -
CREATE OR REPLACE PROCEDURE add_worker 
(
id1 worker.id%type,
NAME1 worker.NAME%type,
SALARY1 worker.SALARY%type,
UNIONNUM1 worker.UNIONNUM%type
)
AS
BEGIN
INSERT INTO  worker(NAME,SALARY,UNIONNUM,ID)
VALUES(NAME1,SALARY1,UNIONNUM1,ID1);
end add_worker;

every thing works fine but here is the problem
when I try to add new worker -
BEGIN add_worker ('mic',1000,9,12345654);

I receive this message -

ORA-06550: line 1, column 41:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

   begin case declare end exception exit for goto if loop mod
   null pragma raise return select update while with
    
    << close current delete fetch lock insert
   open rollback savepoint set sql execute commit forall merge
   pipe1. BEGIN add_worker ('mic',1000,9,12345654);
 

Re: Help in PROCEDURE [message #438176 is a reply to message #438175] Thu, 07 January 2010 06:26 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Have you checked the types of the parameters and the values you are passing to the procedure as arguments?
Do they match?

regards,
Delna
Re: Help in PROCEDURE [message #438179 is a reply to message #438175] Thu, 07 January 2010 06:29 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> BEGIN add_worker ('mic',1000,9,12345654);
  2  /
BEGIN add_worker ('mic',1000,9,12345654);
                                        *
ERROR at line 1:
ORA-06550: line 1, column 41:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe

BEGIN should be completed with END:
SQL> BEGIN add_worker ('mic',1000,9,12345654); END;
  2  /
BEGIN add_worker ('mic',1000,9,12345654); END;
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 1

Now you have another error because the first parameter of the procedure is ID not NAME.

Regards
Michel
Re: Help in PROCEDURE [message #438183 is a reply to message #438175] Thu, 07 January 2010 06:36 Go to previous message
breakid
Messages: 6
Registered: January 2010
Location: IL
Junior Member
thank's for all the help I will try it and cam back with answers.
Previous Topic: escape sequence in pl/sql
Next Topic: substring picturename from path [merged]
Goto Forum:
  


Current Time: Mon Dec 05 21:22:03 CST 2016

Total time taken to generate the page: 0.14813 seconds