Home » SQL & PL/SQL » SQL & PL/SQL » subprograms in pl/sql
subprograms in pl/sql [message #35641] Wed, 03 October 2001 07:10 Go to next message
Tony
Messages: 190
Registered: June 2001
Senior Member
The question is can I have something in the following form, and if so what is the syntax.
This needs to load into memory nothing stored

DECLARE
-- variables
BEGIN
-- procedure here -- The prcedure has its own Begin -- and end here is where the errors pop up.
-- more code here such as cursors etc..
END;

----------------------------------------------------------------------
Re: subprograms in pl/sql [message #35642 is a reply to message #35641] Wed, 03 October 2001 07:28 Go to previous message
Jon
Messages: 483
Registered: May 2001
Senior Member
You can put subroutines in the DECLARE section which are executed from the main line logic. For example...

declare
function square (i IN NUMBER) return NUMBER
is
begin
Return(i*i);
end square;
BEGIN
DBMS_OUTPUT.PUT_LINE(to_char(square(9)));
END;

----------------------------------------------------------------------
Previous Topic: problem in dbms_output
Next Topic: Procedure for creating a user
Goto Forum:
  


Current Time: Sat May 25 03:22:18 CDT 2024