Home » SQL & PL/SQL » SQL & PL/SQL » procedure output parameter with precision (9i)
procedure output parameter with precision [message #402209] Fri, 08 May 2009 01:50 Go to next message
mohannksr
Messages: 28
Registered: January 2009
Junior Member
hi,


in the attached procedure
i am trying to return a decimal
number 16.78.

whether it is possible to return
a decimal number from a procedure..?

whether output parameter of a procedure
can be declared with precision..?

eg:

PROCEDURE CAL_VPF_AMOUNT (PARAMETER1 IN NUMBER,
PARAMETER2 OUT NUMBER(11,4),
PARAMETER3 OUT NUMBER(11,4)
)
IS....


  • Attachment: test1
    (Size: 0.46KB, Downloaded 102 times)
Re: procedure output parameter with precision [message #402233 is a reply to message #402209] Fri, 08 May 2009 02:55 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You can only specify a type for a parameter, not a precision.
Re: procedure output parameter with precision [message #402243 is a reply to message #402233] Fri, 08 May 2009 03:17 Go to previous messageGo to next message
mohannksr
Messages: 28
Registered: January 2009
Junior Member
Is there any way procedure could return a decimal number...?
Re: procedure output parameter with precision [message #402251 is a reply to message #402243] Fri, 08 May 2009 03:31 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I'm not quite sure I understand you.

A procedure with an out parameter of type NUMBER can return any value that is a valid number.
As 10.02 (for example) is a valid number, it can be returned:
SQL> create or replace procedure test_194 (p_in  in  number
  2                                       ,p_out out number) as
  3  begin
  4    p_out := p_in;
  5  end;
  6  /

Procedure created.

SQL> 
SQL> set serveroutput on size 10000
SQL> 
SQL> declare
  2    v_num    number;
  3  begin
  4    test_194 (10.3,v_num);
  5    
  6    dbms_output.put_line('Return value '||v_num);
  7  end;
  8  /
Return value 10.3

PL/SQL procedure successfully completed.
Re: procedure output parameter with precision [message #402723 is a reply to message #402251] Tue, 12 May 2009 03:26 Go to previous message
mohannksr
Messages: 28
Registered: January 2009
Junior Member
Thanks for your reply...

i got it..
Previous Topic: Get a Procedure Code
Next Topic: Displaying all columns in SELECT statement, but group by few
Goto Forum:
  


Current Time: Wed Dec 07 06:41:56 CST 2016

Total time taken to generate the page: 0.11868 seconds