PL/SQL :: Compare 2 Numbers With Different Precision

Jan 30, 2013

Using DB 10.2.0.5, I've encountered a strange behavior today while trying to compare ORA_ROWSCN with a previous SCN stored in a column.

SELECT
h.id HID,
h.ora_rowscn HSCN,
o.id OID,
o.scn OSCN,
[code]......

1157 rows While casting o.scn to a number gives me another resultset (this one is correct):

SELECT
h.id HID,
h.ora_rowscn HSCN,
o.id OID,
o.scn OSCN,
h.ora_rowscn-o.scn DIFF
[code]......     

2114 rows I got the same result if I use NVL(o.scn,0) rather than TO_NUMBER(o.scn). I can't find out why this happens. Obviously, the ">" condition doesn't match when the difference is too small.

AFAIK, ora_rowscn is a NUMBER while my "scn" column is a NUMBER(12) (which should be sufficient to store my DB or remote DB's SCN).

View 9 Replies


ADVERTISEMENT

SQL & PL/SQL :: Extracting Numbers And Few Portion Of Text From A String Containing Dates / Characters And Numbers

Jul 13, 2011

I have a table test with column containing dates, characters and numbers. I have to extract the number part and the three characters before the number . My data looks like :

TEST
ID DATA
1 3/12/2007
2 0
3 3/8/2010 ABC 217
4 NONE
5 COLM XYZ 469 6/8/2011
6 LMN 209

My expected results should look like :

ID DATA
1
2
3 ABC 217
4
5 XYZ 469
6 LMN 209

View 7 Replies View Related

Error Due To Precision Value - ORA-06502

Aug 23, 2012

I got the error "ORA-06502: PL/SQL: numeric or value error: number precision too large" while assigning a value to variable.

For example var Number(5,3);
var:=225.345

Here it should give this error since the no.of digits before decimal should not be more than 2.

In of the procedure, I am getting this error.

Is there any way can we check this violation before assigning this values to a variable?

For example, if the value is too large, we can give a default value etc before assigning it.

Environment: UNIX AIX - 5.3, Oracle 11.2.0.1

View 3 Replies View Related

SQL & PL/SQL :: Precision Greater Than Actual Value

Apr 6, 2012

When we are trying to create number data type column of a table with precision greater than actual value,it's accepting the definition of the table . But we are unable to insert any values into the table.how internally it stores the value

SQL> drop table precision_test;
Table dropped
SQL> create table precision_test(name number(2,5));
Table created
SQL> insert into precision_test values (1);
insert into precision_test values (1)
[code]....

View 5 Replies View Related

Numeric Precision Specifier Is Out Of Range (1 To 38)

Mar 10, 2004

I am trying to run copy command to copy data from one database to other.I 'm getting this error while running copy command. "ORA-01727: numeric precision specifier is out of range (1 to 38)"

View 1 Replies View Related

SQL & PL/SQL :: ORA-01438 - Value Larger Than Specified Precision Allows For Column

Oct 11, 2011

I have a table T1.In that table i have a column id, i gave a number datatype for id as number(2,2). when i try to insert the value im getting an error.

SQL> desc t1;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER(2,2)
NAME VARCHAR2(10)
NAME1 NUMBER

SQL> insert into t1(id) values(2);
insert into t1(id) values(2)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column

SQL> insert into t1(id) values(2.5);
insert into t1(id) values(2.5)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column

SQL> insert into t1(id) values(10.15);
insert into t1(id) values(10.15)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column

SQL> insert into t1(id) values(10.5);
insert into t1(id) values(10.5)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column

View 4 Replies View Related

SQL & PL/SQL :: Value Larger Than Specified Precision Allowed For Column

Mar 21, 2013

I am trying to do bulk insert into a table. Attached is the script I am running:

But when I run this script I get exception : 'ORA-01438: value larger than specified precision allowed for this column'.

I have checked in my soucre table as well as in inserting table, everything looks fine to me.

how to handle such exception, which could actually tell me for what column and what data it is throwing exception.

View 7 Replies View Related

SQL & PL/SQL :: How To Specify Precision And Scale For NUMBER Parameter In Procedure

Nov 7, 2012

I have a procedure. Here is the spec

Procedure countyname(i_lat IN Number, i_lon IN NUMBER, o_countyname OUT VARCHAR2);

The procedure works fine when the input parameter values are small precision like 30.653, -618.765 etc.it fails if the Input parameter values have more precise like 35.694872140886...I think the IN Number can only take upto certain precission.

Is there any way I can specify the precision for a NUMBER input parameter in a procedure?

ex: Procedure countyname(i_lat IN Number(30,10), i_lon IN NUMBER(30,10), o_countyname OUT VARCHAR2);

when I tried the above statement it doesn't compile it gives PLS-00103 error.

View 11 Replies View Related

SQL & PL/SQL :: Numeric Or Value Error - Number Precision Too Large?

Sep 4, 2012

What is the first term in the Fibonacci sequence to contain 1000 digits?
DECLARE
f_num INTEGER;
n_num INTEGER;
h_num INTEGER;

[code]...

why I am getting this error?? Is there any problem in my code??

View -1 Replies View Related

SQL & PL/SQL :: Truncate Precision In Number Datatype Oracle?

Jul 19, 2012

We have truncated number based on the decimal value. i tried to truncate number based on the precision using cast function. i got an error "value larger than specified precision allowed for this colum".

create table TEST_NUMBER
(id number(4,1));
insert into TEST_NUMBER
values(1234.789888888888);

[code]...

ORA-01438: value larger than specified precision allowed for this column
01438. 00000 - "value larger than specified precision allowed for this column"
*Cause: When inserting or updating records, a numeric value was entered that exceeded the precision defined for the column.
*Action: Enter a value that complies with the numeric column's precision, or use the MODIFY option with the ALTER TABLE command to expand the precision.

i want result like 1.8

View 3 Replies View Related

(number Precision Too Large) Using POWER (n / M) Function?

Feb 14, 2012

POWER(47.3616, 27.1261) returns: 2.80403309600359E45 which causes "number precision too large" error in my variable which is defined as NUMBER(20,20).

I've tried ROUNDing and TRUNCing the product, but still get the same long output. The only thing that seems to work is SUBSTR.

Is that the ONLY way to deal with this? It seems like there would be a better way or is there another type I should use these super long decimal results?

SQL> SELECT POWER(47.3616, 27.1261) AS Exp_Val
2 FROM dual;
EXP_VAL
----------
2.8040E+45
SQL>

[code].....

View 2 Replies View Related

Force View Number Data Type Precision?

Aug 18, 2011

I am working on an application that pulls data from an Oracle view into Microsoft Excel (Oracle 11g, MS Excel 2003). It is an automated pivot table created through vba. The problem I'm having is that the decimal points from number columns are being truncated - they don't make it to the pivot table.

When I use the pivot table wizard and set the external data source using a SQL string (select * from view), the precision is not lost. When I create the pivot table automatically in vba, the precision is lost. The pivot table settings, regardless of how the data is brought in, shows the format of the number column as general. This tells me that Excel is trying to figure out what the data type is, and can't (not smart enough).

When looking at the description of the view, the data type is NUMBER (no precision). The table that it is pulling from has the precision set (NUMBER(11,3)). I have tried using the following, but it doesn't work:

select to_number(field_name, '99999999.999') field_name from view

View 7 Replies View Related

SQL & PL/SQL :: ORA-06502 / Numeric Or Value Error - Number Precision Too Large

Dec 7, 2012

How many types of pl/sql value or numeric errors are there and when occurs.Like as follows

1.ORA-06502: PL/SQL: numeric or value error: character string buffer too small

2.ORA-06502: PL/SQL: numeric or value error: number precision too large

View 8 Replies View Related

Getting Error - ORA-01438 (value Larger Than Specified Precision Allowed For Column)?

Dec 31, 2012

SQL> create table t51(t5 NUMBER(25,8));

Table created.

SQL> insert into t51 values (100000000000000000.00000);
insert into t51 values (100000000000000000.00000)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column

View 5 Replies View Related

SQL Tuning Task Fails With ORA-01727 - Numeric Precision Specifier Is Out

Jan 26, 2013

Database was recently upgraded from 10.2.0.4 to 11.2.0.3 and the EM dbcontol repository was recreated.If I schedule a sql tuning advisor task for any sql query, i get this error. I have also tried to drop sysman user and recreate it, but no luck.

Type     Findings     Recommendations     Rationale     Benefit (%)     Other Statistics     New Explain Plan     Compare Explain Plans
Error     ORA-01727: numeric precision specifier is out of range (1 to 38)

View 5 Replies View Related

String Of Numbers

Oct 12, 2007

I have the following set of numbers that i am passing in as one input into a stored procedure.

234,456,234,456,567

Now i want to take this list of numbers and use it in an IN statement:

select * from table where column_a in (P_INPUT);

however, when i try this, it give me an invalid error. I have tried inserting single quote around each value and get the same invalid error. I tried a To_char around my column, which solved the error, but it never finds a match!

View 6 Replies View Related

SQL & PL/SQL :: How To Get Random Numbers

Jul 1, 2010

I want to get 10 random numbers from existing 100 numbers. How can we get/generate random numbers ?

for example I have a table with customer ID, customer Name, having 100 record. We want 10 customers ID randomly from that 100 record not repeated any number. Have any command or procedure for that ?

View 3 Replies View Related

SQL & PL/SQL :: How To Get Column Containing Numbers Only

Jul 25, 2010

I have a column of datatype varchar2

this column may contain char or may contain number or may contain both

some values in this column are only number is there any function or any other way to get those column that are only number

View 3 Replies View Related

SQL & PL/SQL :: Combinations Of Numbers

Nov 1, 2010

Earlier, we had a discussion how to generate the permutations. generating the code for combinations

For eg: if I have input as [1,2,3,4,5] then 5c2 = 20 combinations should be generated as pairs

1,2
1,3
1,4
1,5
2,3
2,4
2,5
3,4
3,5
4,5

Total of 10 combinations

View 8 Replies View Related

SQL & PL/SQL :: Function To Sum Five Numbers

Apr 13, 2013

I am creating a function to sum five numbers (less 1). Is it possible to have an array of numbers in an SQL function, and how would this be implemented?

Here is the screenshot of my output (I cannot embed links until 5 posts!): flic.kr/p/eaSHBP

CREATE OR REPLACE FUNCTION sumfivenumbers ( n1 NUMBER, n2 NUMBER, n3 NUMBER, n4 NUMBER, n5 NUMBER)
RETURN NUMBER
IS
Sumnums NUMBER;
BEGIN
SELECT SUM(n1+n2+n3+n4+n5-1) INTO Sumnums FROM DUAL;
DBMS_OUTPUT.PUT_LINE(Sumnums);
RETURN 1;
END sumfivenumbers;
/
SELECT sumfivenumbers(5,5,5,5,5) AS "Five Numbers less 1" FROM DUAL;

View 7 Replies View Related

SQL & PL/SQL :: Selecting 1st And 2nd TOP Numbers (from Same Row)

Jul 6, 2012

I need to find the top two values value for each ID Number:

CREATE TABLE TABLE_1
(ID number (8),
NUMBER_1 number (2),
NUMBER_2 number (2),
NUMBER_3 number (2),
NUMBER_4 number (2));

INSERT INTO TABLE_1
VALUES
('12345679','30','25','30','05');
INSERT INTO TABLE_1
VALUES
('99999999','30','25','15','05');

Desired Result:

ID Number 1st 2nd
12345679 30 30
99999999 30 25

View 7 Replies View Related

SQL & PL/SQL :: Numbers To Alphabets

Jul 6, 2013

I have a requirement to display numbers as equivalent alphabets , like if the stored value is 1 then it should display as 'A' ,2 means 'B' ,is there a way to find out.

CREATE TABLE APS ( ITEM_NO NUMBER, ITEM_NAME VARCHAR2(12))
INSERT INTO APS (ITEM_NO,ITEM_NAME) VALUES (1,'TEST1');
INSERT INTO APS (ITEM_NO,ITEM_NAME) VALUES (2,'TEST2');
INSERT INTO APS (ITEM_NO,ITEM_NAME) VALUES (3,'TEST3');
INSERT INTO APS (ITEM_NO,ITEM_NAME) VALUES (4,'TEST4');

-- The output to be is.

item_no , item_name
A TEST1
B TEST2
C TEST3
D TEST4

View 23 Replies View Related

SQL & PL/SQL :: Numbers To Words

Jul 6, 2012

I tried to convert numbers to words, it shows the below error.

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 6 11:00:29 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SELECT TO_CHAR (TO_DATE (2447834, 'j'), 'jsp') FROM DUAL;

TO_CHAR(TO_DATE(2447834,'J'),'JSP')
---------------------------------------------------------------------------
two million four hundred forty-seven thousand eight hundred thirty-four

SQL> SELECT TO_CHAR (TO_DATE (244783400, 'j'), 'jsp') FROM DUAL;
SELECT TO_CHAR (TO_DATE (244783400, 'j'), 'jsp') FROM DUAL
*
ERROR at line 1: ORA-01830: date format picture ends before converting entire input string

SQL>

View 4 Replies View Related

PL/SQL :: Extract Numbers Only

Sep 18, 2012

Here i face probelm that he numbers must be follw by DOT "." , this is not correct if the statment only conatines numbers without DOT that not extract. As the

SELECT REGEXP_SUBSTR ( 'hello to 8898989898989 jkjk nnnm mnj'
, '([0-9]+.[0-9]*)' || -- Starts with digit(s) (may or may not have digits after .)
'|' || -- or
'(.[0-9]+)' -- starts with decimal point
) AS result
FROM dual
;

but mean i have to add . after numbers . as follow

SELECT REGEXP_SUBSTR ( 'hello to 8898989898989 jkjk nnnm mnj'
, '([0-9]+.[0-9]*)' || -- Starts with digit(s) (may or may not have digits after .)
'|' || -- or
'(.[0-9]+)' -- starts with decimal point
) AS result
FROM dual
;

but this is not right

i want to extract numbers without DOT also.

View 6 Replies View Related

SQL & PL/SQL :: How To Print Even Numbers Without Using MOD Function

Mar 1, 2012

How to print even numbers 1 to 10.without using the MOD Function

View 17 Replies View Related

Insert All Client Numbers

May 12, 2010

I am trying to run this script:

Update ACT.CUSTOMER_CLIENT_REFERENCE
Set ORIGINAL_SOURCE_FG = 'N',
CANADIAN_ULTIMATE_REFERENCE_FG = 'N',
LUDT = SYSDATE,
CLT_NO = (Select clt_no from client.client where clt_no between 701885 and 705287)
Where Exists (Select 1 from client.client where clt_ofc_no = 19 and clt_no between 701885 and 705287)

But the CLT_NO = .... line is giving me this error: ORA-01427: single-row subquery returns more than one row

what i am trying to do is insert all the client numbers between 701885 and 705287 into ACT.CUSTOMER_CLIENT_REFERENCE

View 6 Replies View Related

SQL & PL/SQL :: Checking Consecutive Numbers

May 11, 2012

I have a table with three columns: terminal, place and batch. How can I check for missing batches?

select * from transactions;

terminal place batch
84812
84813
84814
84816
84821
84823
84824
84825

View 5 Replies View Related

SQL & PL/SQL :: Spell Out Numbers To Words

Mar 14, 2002

I found a message which explain how to spell out numbers to words. I'm french and the purpose of my question is how to convert numbers to word (to print cheque) but in french the function found in the newsgroup was :

select decode( sign( &num ), -1, 'Negative ', 0, 'Zero', NULL ) ||
decode( sign( abs(&num) ), +1, to_char( to_date( abs(&num),'J'),'Jsp') )
from dual
/

I'm afraid but i don't undaunted how pass my number to this function (&num ???)

View 12 Replies View Related

SQL & PL/SQL :: Missing Numbers In A Sequence

Feb 16, 2010

create table t (
number_from number,
number_to number);
insert into t values(1,3);
insert into t values(5,9);
insert into t values(10,15);
commit;

I need to create a stored function that could find/return missing numbers between number_from and number_to for each record in table t.

For example:

Number_fromNumber_to missing

13
594 from previous record, this record is supposed to start from 4

View 24 Replies View Related

Forms :: Calculation When Add Numbers

Feb 5, 2011

I am developing a form where I need to add Numbers.In fact we have a bag of Cones that contain 24 cones.In normal calculation when I add numbers for example

5.24 Plus 5.24 it will give the result 10.48

I Need the appropriate method to calculate if I add these two numbers it should give the result 5.24 Plus 5.24 the result should be 12

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved