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

Home -> Community -> Usenet -> c.d.o.server -> Re: "Sub Routine" Functionality Within Oracle

Re: "Sub Routine" Functionality Within Oracle

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 02 Nov 2006 12:56:28 -0800
Message-ID: <1162500986.300839@bubbleator.drizzle.com>


pmmgpgp_at_gmail.com wrote:

> Mark D Powell wrote:

>> On Nov 2, 9:57 am, "fitzjarr..._at_cox.net" <fitzjarr..._at_cox.net> wrote:
>>> pmmg..._at_gmail.com wrote:
>>>> I have a basic understanding of Functions and Procedures.
>>>> I need to use one or the other as a sub routine ( I need to pass it no
>>>> value and need nothing returned ). I can do with either Function or a
>>>> Procedure but Oracle gives me "Hints" such as the following; that I
>>>> would like either not to happen or need to know how to resolve (have a
>>>> clean compile). I can use the errors to get to the areas Oracle
>>>> recognizes as problems but can't determine what I need to do to get
>>>> Oracle to think I've "used" the variable.
>>>> Thanks
>>>> Dave
>>>> Error: Hint: Value assigned to 'ret' never used in 'cr_data_retention'
>>>> Line: 842
>>>> Text: ret := step07_Apply_min_term('nada');
>>>> Error: Hint: Variable 'Trunk_Them' is declared but never used in
>>>> 'step00_trunc'
>>>> Line: 128
>>>> Text: Trunk_Them varchar2(1) :=
>>>> pkg_cr_Cust_Retention_data_BSC.Truncate_test_Tables('Y');You haven't used them, so why should Oracle think you have? And why
>>> are you trying to use a function to process data without returning some
>>> value? A procedure is what you would need to take no input, provide no
>>> output yet process data. And I don't understand why you declare
>>> variables you know you won't use.
>>>
>>> Of course all of this means nothing without seeing the actual code
>>> you've written; why have you not provided this?
>>>
>>> David Fitzjarrell- Hide quoted text -- Show quoted text -
>> I agree with David.
>>
>> You need to either post at leat part of the code. If you are only
>> trying to ask general questions of the nature, "I can do A or B, when
>> should I choose A over B?" then you need to explain your questions in
>> more detail.
>>
>> HTH -- Mark D Powell --
> 
> Thanks guys, I may have been too general.
> The only way I know to declare a procedure requires the inclusion
> of a parameter or signature such as the "param" in
> "PROCEDURE my_proc(parar in varchar2) as ...." .
> This is how/why it is "declared". Is there a way not to include a
> parameter or signature ? If it is essential what makes Oracle recognize
> that it has been used ? I've tried things like some useless "if"
> statement
> ( if param = param then
>   param = null;
>  end if;) to no avail.
> 
> One thought is that I use PL/SQL developer and this my relate to the
> tool and not PL/SQL at all . Any thoughts on rhis ?
> 
> Thanks dave

The simplest procedure possible is:

CREATE OR REPLACE PROCEDURE x IS
BEGIN
   NULL;
END x;
/

Everything else is just a variation on the theme.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Thu Nov 02 2006 - 14:56:28 CST

Original text of this message

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