| Data Type to return decimal values in function [message #578287] |
Tue, 26 February 2013 10:14  |
gentleman777us
Messages: 96 Registered: April 2005
|
Member |
|
|
Hi,
I have the following database function.
GetRegionDetails(id in varchar2, o_lat out number, o_lon out number);
The problem is, the output values are returning as whole numbers ie. 38.108766567 is being returned as 38 and -78.16423574566 is returned as 78
what data type I should use so that my output is returns all the decimal values?
Thanks
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Data Type to return decimal values in function [message #578414 is a reply to message #578385] |
Wed, 27 February 2013 15:03  |
Bill B
Messages: 989 Registered: December 2004
|
Senior Member |
|
|
run the following command. Does it return a whole number?
SELECT commision
FROM employee
WHERE empno = 1;
and your function should be
CREATE OR REPLACE FUNCTION cv_fn1 (ido IN NUMBER)
RETURN NUMBER
AS
osal number;
BEGIN
SELECT commision
INTO osal
FROM employee
WHERE empno = ido;
RETURN osal;
END;
and your test should be
DECLARE
retval NUMBER;
ido NUMBER;
BEGIN
ido := 1;
retval := psdba.cv_fn1 (ido);
DBMS_OUTPUT.put_line (retval);
END;
[Updated on: Wed, 27 February 2013 15:10] Report message to a moderator
|
|
|
|