How is stored procedure created?

From: ispa <ispa_at_beagle.ispa.fsu.edu>
Date: 28 Feb 1995 18:24:46 GMT
Message-ID: <3ivppe$lb5_at_mailer.fsu.edu>


        How is a stored procedure creted and used? Let's take for example the following PL/SQL script.

DECLARE

	num	BUDGET_ALLOCATION.BUD_NO%TYPE;
	code	BUDGET_ALLOCATION.BUD_CODE%TYPE;

	CURSOR	newalloc IS
		SELECT BUD_CODE FROM BUDGET_CODE ;

BEGIN         num := '366600001';

  • Clear any previous references DELETE BUDGET_ALLOCATION WHERE BUD_NO = num;
  • Create new budget allocations and set them to zero OPEN newalloc; LOOP FETCH newalloc INTO code; EXIT WHEN newalloc%NOTFOUND;
		INSERT INTO BUDGET_ALLOCATION VALUES (num, code, 0, 0, 0, 0);
	END LOOP;
 	CLOSE newalloc;	

COMMIT;
END;
/

        The procedure basically sets several columns in table to zero. It works and I can run it from sqlplus by using its file name as _at_setalloc.

        Let's say I want to turn it into a store procedure which takes a parameter for the value of num (see PL/SQL procedure).         

        How do I do it? And how can I call it? Received on Tue Feb 28 1995 - 19:24:46 CET

Original text of this message