Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> error on procedure

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: error on procedure
 RK  Posted: Jun 11, 2007 12:01:49 PM

 Total Post: 37
 Joined: Apr, 2007






 create table item_details
(item_code number(5) not null,
item_name varchar2(50) not null,
quantity number(5),
sp_price number(8,2),
constraint con_pk_itemcode primary key(item_code))
/
--the above is the table


--the below is the procedure on the above table to insert data
create or replace procedure proc_id
(v_itemcode IN item_details.item_code%type,
v_itemname IN item_details.item_name%type,
v_quantity IN item_details.quantity%type,
v_sp IN item_details.sp_price%type)
is
begin
insert into item_details
values(v_itemcode,v_itemname,v_quantity, v_sp);
end proc_id;
/


--the below is a plsql block

declare
v_itemcode item_details.item_code%type;
v_itemname item_details.item_name%type;
v_quantity item_details.quantity%type;
v_sp item_details.sp_price%type;
begin
for i in 1..2 loop
execute proc_id(&v_itemcode,'&v_itemname',&v_quantity,&v_sp);
end loop;
end;
/
NOW MY DOUBT IS when i execute the 3rd block indivually it gives error.please help me on this area....I AM USING ORACLE 9i ENTERPRISE..

 sudha
Posted: Jun 11, 2007 03:52:03 PM  

 Total Post: 15
 Joined: Jan, 2007






 
hi rk
why ur using for loop in the block?
just call the procedure...
i think this code work properly


declare
v_itemcode item_details.item_code%type;
v_itemname item_details.item_name%type;
v_quantity item_details.quantity%type;
v_sp item_details.sp_price%type;
begin
proc_id(&v_itemcode,'&v_itemname',&v_quantity,&v_sp);
end;
/

try it once
-Regards
Sudha

 KS
Posted: Jun 20, 2007 08:41:58 AM  

 Total Post: 65
 Joined: Nov, 2006






 
Hi,

You are getting the error because of the Keyword EXECUTE.
To execute a procedure inside the PL/SQL block , you need not to use the EXECUTE Keyword.

-Sri



 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi333
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software