Home » SQL & PL/SQL » SQL & PL/SQL » one time only procedure
one time only procedure [message #225268] Mon, 19 March 2007 08:07 Go to next message
getritesh
Messages: 235
Registered: July 2006
Location: INDIA
Senior Member

Please brief on one time only procedure
The procedure without END section keyword of BEGIN and END;
Re: one time only procedure [message #225271 is a reply to message #225268] Mon, 19 March 2007 08:10 Go to previous messageGo to next message
joy_division
Messages: 4644
Registered: February 2005
Location: East Coast USA
Senior Member
What?
Re: one time only procedure [message #225273 is a reply to message #225268] Mon, 19 March 2007 08:18 Go to previous messageGo to next message
rigatonip
Messages: 50
Registered: December 2005
Member
Maybe you mean an anonymous PL/SQL block? Look for this in the PL/SQL manual or on the net. You'll find lots of info and examples on the topic. Or you could pick up a PL/SQL book...

[Updated on: Mon, 19 March 2007 08:19]

Report message to a moderator

Re: one time only procedure [message #225450 is a reply to message #225268] Tue, 20 March 2007 00:03 Go to previous message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
The optional section of a package body after BEGIN, that is not part of any procedure or function, is executed only once, the first time the package is referenced.

CREATE OR REPLACE PACKAGE package_name 
AS
   FUNCTION f_name ... ; 
   PROCEDURE  p_name ... ;
END package_name;
/
CREATE OR REPLACE PACKAGE BODY package_name 
AS
   FUNCTION f_name... BEGIN ... END f_name;
   PROCEDURE p_name ... BEGIN ... END p_name;
BEGIN 
   -- whatever you put here executes only once,
   -- the first time the package is called
END package_name;
/


The insert statement in the initialization part at the end of the emp_admin package is executed only once in the following example:

http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14261/packages.htm#i4362

Previous Topic: Using the Accept Command
Next Topic: Insufficient privs to create sequence from procedure
Goto Forum:
  


Current Time: Fri Dec 09 17:30:26 CST 2016

Total time taken to generate the page: 0.26632 seconds