Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to store Value greater than 38 digits ?? Help !!
Hi DBAs,
Thanks for the prompt replies.
We have solved it using Java in the stored procedure. We created a java function which will manipulate the numeric value and return it as string. This java function is wrapped into a PL/SQL function which returns Varchar2 !.
Step 1. The JAVA program is as follows
public class functions
{
public static void main(String args[])
{
System.out.println("Double Value :"+ new functions().Funct());
System.out.println("String Value :"+ new functions().FunctStr());
}
public static double Funct()
{
double n = 1;
double t = 1;
double a = 315;
double t1 =0;
while (n <= a)
{
t = (t*a)/n; t1 = t1 + t; n = n+1;
}
return t1;
}
public static String FunctStr()
{
return ( "" + ( new functions().Funct() ) + "" );
}
}
Step 2. Then this was loaded in the databse user scott using loadjava.
Step 3. A wrapper was written to create a function which will return a varchar2.
Create or replace function testjava return varchar2
as
language java name 'functions.FunctStr() return java.lang.String';
Step 4. A pl/sql procedure to call the function and test.
set serverout on size 1000000
declare
ret varchar2(4000) := 'A';
begin
ret := testjava;
dbms_output.put_line(ret);
end;
Regards,
Arul.
> -----Original Message----- > From: DENNIS WILLIAMS [SMTP:DWILLIAMS_at_LIFETOUCH.COM] > Sent: 19 June 2002 15:58 > To: Multiple recipients of list ORACLE-L > Subject: RE: How to store Value greater than 38 digits ?? Help !! > > Shradha - What are you saying? > 1. You require more than 38 digits of accuracy? > 2. Your number is larger than 38 digits. > > If the problem is the first, wow, you must be into something incredible. > If the problem is the second, no problem. Data also stores "scale", which > can be up to 127. That means 10 to the 127th power. > > Dennis Williams > DBA, 20% OCP > Lifetouch, Inc. > dwilliams_at_lifetouch.com > > > > -----Original Message----- > Sent: Wednesday, June 19, 2002 9:08 AM > To: Multiple recipients of list ORACLE-L > > > Hi DBAs, > > One of my projects is facing a problem, they are using a numeric datatype > for a column, in the process part the calulation is leading to a number > larger than 38 digits. > > Therefore they are not getting a result ie procedure is not returning > anything. > > If you have come across such a thing ?...Inputs are welcome > > Thanks and regards, > Shradha >
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: arul.kumar_at_bt.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Fri Jun 21 2002 - 11:15:30 CDT
![]() |
![]() |