Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Newbie Question on Creating procedure

Newbie Question on Creating procedure

From: DavidP185 <davidp185_at_aol.com>
Date: 10 Oct 1998 16:54:50 GMT
Message-ID: <19981010125450.19677.00004963@ng62.aol.com>

I've got the following PL/SQL statement to add new revision data to a file. It works fine as is but I would like to create it as a procedure but everytime I do I am getting
errors. Could someone please show me the proper syntax to do this.

DECLARE
    NewProd VARCHAR2(10);
    NewRev NUMBER(3);
    NewInfo VARCHAR2(8);
    NewQty NUMBER(4);
    CURSOR MyCursor IS

      SELECT PRODUCT,REV+1,INFO,QTY
	  FROM  TEST
	  WHERE PRODUCT = 'TEST1' AND REV = 2;
  BEGIN
    OPEN MyCursor;
	LOOP
	  FETCH MyCursor INTO NewProd,NewRev,NewInfo,NewQty;
	  EXIT WHEN MyCursor%NOTFOUND;
	  INSERT INTO TEST  
	    VALUES(NewProd,NewRev,NewInfo,NewQty);
	END LOOP;
	CLOSE MyCursor;
	COMMIT WORK;

  END; I would like to be able to pass the product (TEST1) and the REV (2) in as the parameters. If there are any suggestions as to how to make the procedure more efficient I would appreciate them as well.   Thanks in advance.
David Potter Received on Sat Oct 10 1998 - 11:54:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US