This discussion is archived
2 Replies Latest reply: Oct 29, 2012 8:33 PM by 970843 RSS

How to write procedure with multiple queries

970843 Newbie
Currently Being Moderated
Hi,

Table1
1.Id
2.Count

I want to write a procedure to find 'Count' in the table with 'Id' as key.After getting 'count' i have to increment it and update back in the table for that 'Id', how can i handle this with procedure.Help me with solution.


I want a simple procedure like below, BUT ITS NOT EXECUTING.IT SAYS PROCEDURE SUCCESSFUL WITH COMPILATION ERRORS.Help me out.

create or replace PROCEDURE newpro( inId IN NUMBER, outcount OUT NUMBER) is
select COUNT into outcount from Table1 WHERE ID= inId ;
BEGIN
outcount := outcount +1;
update Table1 set COUNT = outcount WHERE ID = inId ;
END;

Edited by: im_asa on Oct 29, 2012 4:59 AM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points