Number precision and scale
I have a xml document that I want to test against the shredded schemas. The XSD type creates a number(6,1).
When I insert the xml document if the number is 2.22 it will insert the record even if the XSD has a xs:fractionDigits value="1"
I realize Oracle uses floating point and truncates or rounds the number. Is there a way to have an error on the xml document load if the decimal point is larger then one digit as defined in the XSD?
Mark,
The schema has 10 xsd files with includes. I pasted a portion of the one that had the fractional digit 6,1. Did you want all 10, or this what you are looking for?
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by mbarth (Computer Science Corp.) -->
<xs:schema targetNamespace="http://science.doe.gov/ePME" xmlns:epme="http://science.doe.gov/ePME" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<xs:include schemaLocation="countries.xsd"/>
<xs:include schemaLocation="purpose.xsd"/>
<xs:include schemaLocation="reason.xsd"/>
<xs:include schemaLocation="research_areas.xsd"/>
<xs:include schemaLocation="research_cat_ids.xsd"/>
<xs:include schemaLocation="work_cat_ids.xsd"/>
<xs:complexType name="fiscal_year_budget_info">
<xs:sequence>
<xs:element name="staffing_scientific" nillable="false" minOccurs="0">
<xs:annotation>
<xs:documentation>Scientific staffing in full-time equivalent person years</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="1"/>
<xs:totalDigits value="6"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="staffing_other_direct" minOccurs="0">
<xs:annotation>
<xs:documentation>Other direct staffing in full-time equivalent person years</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="1"/>
<xs:totalDigits value="6"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="staffing_total_direct" minOccurs="0">
<xs:annotation>
<xs:documentation>Total direct staffing in full-time equivalent person years</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="1"/>
<xs:totalDigits value="6"/>
</xs:restriction>
</xs:simpleType>
Similar Messages
-
What is the point of Precision and Scale in Number Type?
Version :11.2
What is the point in having PRECISION and SCALE in number type? If you create the column with just NUMBER ie.without
specifying precision or scale , you can enter numbers with any precision and scale.
SQL> select * From v$version where rownum < 2;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
SQL> create table t1 (col1 number);
Table created.
SQL> insert into t1 values (223.9939394);
1 row created.
SQL> insert into t1 values (88.228384);
1 row created.
SQL> insert into t1 values (9.34);
1 row created.
SQL> insert into t1 values (000.00);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
COL1
223.993939
88.228384
9.34
0Did you ever have a business scenario where a Numerical column should store values only with a fixed precision and scale ?Omega3 wrote:
Version :11.2
What is the point in having PRECISION and SCALE in number type? If you create the column with just NUMBER ie.without
specifying precision or scale , you can enter numbers with any precision and scale.
SQL> select * From v$version where rownum < 2;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
SQL> create table t1 (col1 number);
Table created.
SQL> insert into t1 values (223.9939394);
1 row created.
SQL> insert into t1 values (88.228384);
1 row created.
SQL> insert into t1 values (9.34);
1 row created.
SQL> insert into t1 values (000.00);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
COL1
223.993939
88.228384
9.34
0Did you ever have a business scenario where a Numerical column should store values only with a fixed precision and scale ?Lots of business requirements for specific precisions and scales.
A persons Age may required to be stored as whole numbers of no more than 3 digits.
A sum of money may required to be stored with no more than 2 decimal places of accuracy e.g. GB Pounds and Pence or US Dollars and Cents
A unit of length may required to be stored in metres with 2 decimal places for centimetres
A shoe size may be required to be stored with one decimal place for half sizes
etc.
etc.
Yes, you may just create all of them as generic NUMBER datatype, but creating them with precision and scale can provide additional information about the limitations expected for the values stored, especially for things like reporting tools that may use the specified precision and scale to determine how to display the values automatically (by default).
If you start questioning "what's the point?" then you may as well say what's the point in having a NUMBER datatype when we can store numbers in a VARCHAR2 datatype? or what's the point in having a DATE datatype when we can stored dates as VARCHAR2 datatype? etc.
No point in asking such a question because there's almost always a point to these things (and if there isn't they get deprecated in later versions). -
How to specify precision and scale for a datatype in create procedure statement
Specifying precision and scale in the datatype when creating a procedure does not work:
create or replace function SqlTxFunctionTesting(inparam in number(9,2)
Error(1,48): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.user4928701 wrote:
Specifying precision and scale in the datatype when creating a procedure does not work:
create or replace function SqlTxFunctionTesting(inparam in number(9,2)
Error(1,48): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
And one of the cons in the PL/SQL language in my view.
The language does not allow parameters to be declared in the fashion you are attempting to. Even declaring a subtype and using that, does not enforce either the precision or scale, on the parameter value passed.
Even worse - the parameter value can be a different data type all together from the defined parameter type - and a silent and implicit data type conversion will be done at run-time.
So you can expect run-time errors in your code unit caused by the caller passing invalid values, despite the compiler okaying the call from the caller to your code.
There are pros and cons to this approach. But if you are from a very strong type language environment like C or Pascal, you tend to see more cons than pros in this specific case. -
Can I know the precision and scale of a decimal field using ACEDAO?
Using ACEDAO in VC++, I am trying to retrieve the field details of an Access database (.accdb file) table of which one field is of decimal type. I am able to get the details using the functions of
DAO::_FieldPtr field;
as follows:
fieldName = field->GetName().GetBSTR();
nType = field->GetType() // returns DAO::dbDecimal
lSize = field->GetSize(); // returns 16
lAttr = field->GetAttributes(); // returns 0x000002H
nOrdinal = field->GetOrdinalPosition(); // returns 11
bAutoIncrement = ((lAttr & DAO::dbAutoIncrField) > 0);
DAO::PropertiesPtr props;
DAO::PropertyPtr prop;
int k, nProp;
std::wstring propName, propNames;
props = field->GetProperties();
if(props)
nProp = props->GetCount(); // returns 33
for(k = 0; k < nProp; k++)
prop = field->GetProperties()->GetItem((short) k);
if(prop)
propName = prop->GetName().GetBSTR();
propNames += propName;
propNames += L"\n";
// After exiting the loop, propNames contain 33 properties as:
// Value
// Attributes
// CollatingOrder
// Type
// Name
// OrdinalPosition
// Size
// SourceField
// SourceTable
// ValidateOnSet
// DataUpdatable
// ForeignName
// DefaultValue
// ValidationRule
// ValidationText
// Required
// AllowZeroLength
// AppendOnly
// Expression
// FieldSize
// OriginalValue
// VisibleValue
// GUID
// ColumnWidth
// ColumnOrder
// ColumnHidden
// Description
// DecimalPlaces
// DisplayControl
// TextAlign
// AggregateType
// ResultType
// CurrencyLCID
//But does not have any property named "Scale" or "Precision"
I could not find any function for retrieving the value for precision and scale for the decimal field.
Though I am able to retrieve the field value as a decimal number and get the required information from the structure, I think it is not the right way. Because, what will happen if the data for field is not available in the table?
Is there any other method to retrieve the precision and scale of a decimal type field using ACEDAO?
Thanks.I cannot find a method or property in ACEDAO to retrieve the precision and scale of a field. Maybe you could try get the number of a decimal type and use some mathematical methods to get the precision.
I find there are some way to get the precision by ADO or OLEDB.
For ADO way, you could check this thread:
https://social.msdn.microsoft.com/Forums/office/en-US/883087ba-2c25-4571-bd3c-706061466a11/how-can-i-programmatically-access-scale-property-of-a-decimal-data-type-field?forum=accessdev
For OLE DB , you could use IColumnsInfo::GetColumnInfo to get DBCOLUMNINFO::bPrecision.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms722704(v=vs.85).aspx
Also people in C++ may not familiar with access development, the
Access for Developers forum is good place for access develop issue. You could try there.
Hope this helps some.
Shu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
I am creating some application tables with APEX. When i define a column on my table for primary or foreign keys I select the NUMERIC datatype. The form then prompts me for Precision and Scale. What are the recommended values for precisions and scale for key columns? I understand that precision is the total number of digits before and after the radix but what is meant by scale - the number of digits after the radix? I'm a little rusty on these issues as it has been a long time since I used them.
Thanks, NedHi
Just to add to this (definitions spot on though as Paul pointed out)...
'NUMERIC' is not an Oracle datatype. The datatype is NUMBER. Oracle supports NUMERIC in a create statement but it is stored as NUMBER under the hood.
Using precision and scale definitions is not necessary, you can define number just on it's own and it will handle what you throw into it. The design consideration comes into exactly what you are going to use the field for.
I came across a situation where a company were creating their administration system (and this was a reasonably large company with some very important data) and had decided to use NUMBER(9) for the PK ID column on all their major tables. Sure enough, 10 years later this started to cause a problem cause the were running out of numbers! (okay, this is no big deal to fix but it's just an example). The reasoning had originally been because Oracle Forms defaulted the display field length to that in the data dictionary it would save them the effort of changing it manually every time they created a new form!
I generally define NUMBER as NUMBER unless there is a valid rule to say that it is and always be something that can be defined. For example monetary amounts - Japanese Yen can't have decimals so it should be held in a NUMBER (10,2) field (although lots of people do this for their 'amount' columns anyway). The data rules.
Cheers
Ben
http://www.munkyben.wordpress.com
Don't forget to mark replies helpful or correct ;)
Edited by: Munky on Aug 19, 2009 8:01 AM -
Precision and scale for numeric datatypes
Could be in XSU, could be in Oracle thin driver, but I'd expect the SAL column of the EMP table to include its precision and scale, e.g. 800.00 and not 800.
oracle: decribe EMP
NAME TYPE
SAL NUMBER(7,2)
sql server: sp_help EMP
Column_name Type Length Prec Scale
SAL numeric 5 7 2
sql server:
java myOracleXML getXML -conn "jdbc:inetdae7:aetius:1433?database=Northwind" -user "sa/sa" "select SAL from EMP where EMPNO > 7999"
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<SAL>800.00</SAL>
</ROW>
</ROWSET>
oracle:
java OracleXML getXML -user "scott/tiger" "select sal from
emp where empno > 7999"
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<SAL>800</SAL>
</ROW>
</ROWSET>
So who loses the scale in the Oracle case, the driver or XSU.
Steve.user4928701 wrote:
Specifying precision and scale in the datatype when creating a procedure does not work:
create or replace function SqlTxFunctionTesting(inparam in number(9,2)
Error(1,48): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
And one of the cons in the PL/SQL language in my view.
The language does not allow parameters to be declared in the fashion you are attempting to. Even declaring a subtype and using that, does not enforce either the precision or scale, on the parameter value passed.
Even worse - the parameter value can be a different data type all together from the defined parameter type - and a silent and implicit data type conversion will be done at run-time.
So you can expect run-time errors in your code unit caused by the caller passing invalid values, despite the compiler okaying the call from the caller to your code.
There are pros and cons to this approach. But if you are from a very strong type language environment like C or Pascal, you tend to see more cons than pros in this specific case. -
Validation of numeric value precision and scale
Hi all,
Iam using ADF with EJBs.
I have one inputText field that will accept numeric values (of java.lang.Double type). Due to database constraints I want to validate the input value on its precision and scale.
I put an f:convertNumber tag under the inputText and set the MaxIntegerDigits and MaxFractionDigits properties with the desired values.
I also set the ApplyValidation property of the corresponding attribute in the pagedef file. However no validation worked.
I made the same test with af:ConvertNumber with no result too.
I know that with BC4J it is easy to set such constraints at the entity level.
Is there any neat way to set validation or I need to write code in the backing bean?<af:convertNumber> works fine for me. see the following code
<af:inputText id="it1">
<af:convertNumber type="number" minFractionDigits="2" maxIntegerDigits="4" maxFractionDigits="2"/>
</af:inputText>
Another possible solution with regular expression
<af:inputText id="it3" value="9999.99">
<af:validateRegExp pattern="\[0-9\]\[0-9\]\[0-9\]\[0-9\].\[0-9\]\[0-9\]"/>
</af:inputText>
regards
srini
Edited by: sangara on Jan 17, 2010 9:53 PM -
Specifying precision and scale
Hello,
I have a table that was created with a column pfixed NUMBER(38). The data contains up to 16 numbers after the decimal point (e.g. <pfixed>4.8283510208129883</pfixed>). XSU loads it with scale of 0, which results in everything after the decimal being truncated. The precision is correctly set to 38, to match the NUMBER column.
Is this a problem with the create table statement, or is there a way to tell XSU what scale to use?
Thanks,
Leilai'm not sure if i understand your problem..
you say you (or someone else) declared a
table with NUMBER(38) and you want 0.??? written to it (or from ??)...
then why not declare your own precision
( format NUMBER(a,b)
where a is size and b is precision)
assume the number xxx.yyyy
format NUMBER(2,4) stores xx.yyyy
format NUMBER(1,2) stores x.yy
format NUMBER(3,1) stores xxx.y
38 is NOT your precision, it's SIZE !!
i hope this helps...
null -
Precision and Scale in NUMBER datatype
In oracle, if you want to store a number like 892.34, you need to declare the NUMBER type like
number(5,2)Here 5 stands for the total number of digits including the numbers after the decimal point.
2 stands the number of digits to the right of the decimal.
Isn't this confusing? Can't they just make the syntax like
number(3,2)where 3 is the number of digits from left till the decimal and 2 is the number of digits after the decimal.create table t ( n number( 6, 5 ) ) ;
alter table t add constraint c check ( n between 0.00001 and 0.1 ) ;
invalid value will throw
SQL Error: ORA-02290: check constraint (SYS.C) violated
*Cause: The values being inserted do not satisfy the named check
*Action: do not insert values that violate the constraint. -
The SDO_ORDINATES in the CTL file generated by shp2sdo contain only 6 decimal places even though the source shapefile contains ordinates with a larger scale (as evidenced via ESRI products and reviewing the geometries generated when the spatial layer is created via ArcSDE). The -t tolerance parameter seems to have no effect on the actual SDO_ORDINATES scale (just effects the metadata). Is this a limitation in shp2sdo or is something else going on here?
Thank you for your help, JamesCan anyone please tell were I can get a copy of shp2sdo. I have done a search on it's name and have found no software by this name.
Thanks,
John look at:
http://otn.oracle.com/software/products/spatial/content.html
for the shapefile converter and other Spatial tools
Mark -
Having trouble after osi7 on my iPad, I have one contact that won't recognize a number? Also can't move and scale a photo for wallpaper.
Downloads available:
Suites and Programs: CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
Acrobat: XI, X | 9,8 | 9 standard
Premiere Elements: 13 | 12 | 11, 10 | 9, 8, 7
Photoshop Elements: 13 |12 | 11, 10 | 9,8,7
Lightroom: 5.7.1| 5 | 4 | 3
Captivate: 8 | 7 | 6 | 5
Contribute: CS5 | CS4, CS3
Download and installation help for Adobe links
Download and installation help for Prodesigntools links are listed on most linked pages. They are critical; especially steps 1, 2 and 3. If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'. -
PL/SQL: numeric or value error: number precision too large
hi ,
i am running my script and getting this error. i created a object and and make table type on this with fraction of number(2,2). and in my script i am calling a standard API which have hour in number only .i am also using a custome table also which also having number(2,2). so plz help me to resoulve thsi error.
description below:
DECLARE
l_Return_Status VARCHAR2 (30):=NULL;
l_Msg_Count NUMBER :=0;
l_Msg_Data VARCHAR2 (2000) := NULL;
v_Sape_Sco_info_Tbl SAPE_SCO_INFO_TBL;
v_Sape_Sco_info_rec SAPE_SCO_INFO_REC;
p_assignment number:=165316; -----165688;
p_project_id number:=74538; -----81993;
sco_id number:=10371;
BEGIN
v_Sape_Sco_info_Tbl := SAPE_SCO_INFO_TBL();
v_Sape_Sco_info_rec := SAPE_SCO_INFO_REC(p_assignment,p_project_id,sco_id,'15-Oct-2009','31-Oct-2009',15.00,'17-Oct-2009','20-Oct-2009','ADD_EXISTING_RESOURCES',02.50,NULL,'Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
v_Sape_Sco_info_Tbl.EXTEND;
v_Sape_Sco_info_Tbl(1) := v_Sape_Sco_info_rec;
SAPE_UPDATE_SCO_DETAILS_PKG.SCO_ROLE_INCREASE(
x_project_id =>p_project_id,
x_Assignment_Id =>p_assignment,
l_Sape_Sco_info_Tbl => v_Sape_Sco_info_Tbl,
x_called_function =>'ADD_EXISTING_RESOURCES',
x_Return_Status =>l_Return_Status,
x_Msg_Count =>l_Msg_Count,
x_Msg_Data =>l_Msg_Data
dbms_output.put_line('second Procedure executed sucessesfuly');
dbms_output.put_line('l_Return_Status '||l_Return_Status||' l_Msg_Count '||l_Msg_Count||'l_Msg_Data');
dbms_output.put_line('value'||' '||v_Sape_Sco_info_Tbl(1).Assignment_Id);
dbms_output.put_line('completed');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm(sqlcode));
END;
error :PL/SQL: numeric or value error: number precision too large
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_TBL IS TABLE OF SAPE_SCO_INFO_REC;
Prompt OBJECT TYPE SAPE_PA.SAPE_SCO_INFO_REC
DROP TYPE SAPE_PA.SAPE_SCO_INFO_REC;
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_REC AS OBJECT
( Assignment_Id NUMBER,
project_id Number,
sco_id Number,
Role_START_DATE DATE,
Role_END_DATE DATE,
avg_hrs_per_day NUMBER(2,2),
sco_role_start_date DATE,
sco_role_end_date DATE,
sco_role_mode VARCHAR2(250),
sco_hrs_per_day NUMBER(2,2),
no_of_copies Number,
Active_Flag VARCHAR2(10),
BILLABLE_UPSIDE_INDICATIOR VARCHAR2(5),
RET_CODE VARCHAR2(5),
ERROR_MSG VARCHAR2(255),
ATTRIBUTE1 VARCHAR2(240),
ATTRIBUTE2 VARCHAR2(240),
ATTRIBUTE3 VARCHAR2(240),
ATTRIBUTE4 VARCHAR2(240),
NATTRIBUTE1 NUMBER,
NATTRIBUTE2 NUMBER
CREATE TABLE SAPE_PA.SAPE_SCO_STAFFING_MAPPINGS
( PROJECT_ID NUMBER,
SCO_ID NUMBER,
ASSIGNMENT_ID NUMBER PRIMARY KEY,
SCO_ROLE_START_DATE DATE,
SCO_ROLE_END_DATE DATE,
SCO_ROLE_HOURS NUMBER(2,2),
SCO_MODE VARCHAR2(80),
ACTIVE_FLAG VARCHAR2(5),
LAST_UPDATE_DATE DATE,
LAST_UPDATED_BY NUMBER(15,0),
CREATION_DATE DATE,
CREATED_BY NUMBER(15,0),
LAST_UPDATE_LOGIN NUMBER(15,0),
ATTRIBUTE1 VARCHAR2(240),
ATTRIBUTE2 VARCHAR2(240),
ATTRIBUTE3 VARCHAR2(240),
ATTRIBUTE4 VARCHAR2(240),
NATTRIBUTE1 NUMBER,
NATTRIBUTE2 NUMBER
)The problem here is with avg_hrs_per_day NUMBER(2,2)+ of SAPE_SCO_INFO_REC object.
user12226862 wrote:
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_REC AS OBJECT
( Assignment_Id NUMBER,
project_id Number,
sco_id Number,
Role_START_DATE DATE,
Role_END_DATE DATE,
avg_hrs_per_day NUMBER(2,2),
sco_role_start_date DATE,And while assigning the value it is:
user12226862 wrote:
v_Sape_Sco_info_rec := SAPE_SCO_INFO_REC(p_assignment,p_project_id,sco_id,'15-Oct-2009','31-
Oct-2009',15.00,'17-Oct-2009','20-
Oct-2009','ADD_EXISTING_RESOURCES',02.50,NULL,'Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);Note that number(2,2) means maximum total of digits in that case is 2 (including scale), not 4.
E.g.
SQL> declare
2 x number(2,2);
3 begin
4 x := 02.50;
5 end;
6 /
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 4However, this works:
SQL> declare
2 x number(2,2);
3 begin
4 x := .50;
5 end;
6 /
PL/SQL procedure successfully completed.Cheers,
AA -
QT Rookie Edit - Add to Selection and Scale does not work
Nothing happens when I try to add a photo to a section of a movie.
Following page 35 of the QT 7.3 User Guide:
I copy the photo from QT View Photo.
I select the section of the movie I want to paste it in.
I position the playhead over the start of the selected section.
I hit Edit > "Add to Selection and Scale"
But, the photo does not show in the movie when I play the movie through the selected section.
I eventually want to put 8 different photos throughout the movie.
I can paste a one second blip using Edit > Paste that does show in thew movie.
Where am I going wrong?You first create a "selection" (in and out points) in the timeline. No need to position the cursor anywhere as the selection automatically has the focus.
As you add tracks you then adjust their position, layer number and offset values (if needed) in the Visual Settings tab of the Movie Properties window. -
Flex Application Stage Size and Scale
I am trying to create a Web and Desktop flex application for people who may have less than perfect vision. I would like to allow the users to magnify everything on the screen (including text, buttons, images, etc.) if necessary. I have gotten the magnification step down using the following code in the main Application
var matrix:Matrix = this.transform.matrix;
var scale:Number = 2;
matrix.scale(scale, scale);
this.transform.matrix = matrix; // this refers to the main Application
Of course, by doing so, the Flex Application will be too big for the Flash Player window and only the top left quarter of the application is visible. I figure the next step is to decrease the Flex Application stage size by 50% to compensate. For some reasons, I can't figure out how to change the stage size of the Flex Application so that it only occupies the top left quarter of the Flash Player window.
Any thoughts? Thanks a lot!Instead of manipulating the application, why not wrap all your content inside a container with scroll bars? You can then magnify the content and scroll it.
I'd give it a go, but I have loads of other things to do and I can't help wondering if the browser is better at magnifying content. -
I have hit with above error and the code did run successfully before the minor change in the portion I have bolded. Appreciate your comment & help.
Attached with the code:
CREATE TABLE RPT1120B_CHANNEL_new
(SUBSCRIBER_NO NUMBER (9),
FP_CHANNEL VARCHAR2(255),
FP_DATE DATE,
FP_DYNASTY CHAR(1),
FP_MOVIE CHAR(1),
FP_FUN CHAR(1),
FP_LEARNING CHAR(1),
FP_NEWS CHAR(1),
FP_SPORTS CHAR(1),
FP_VARIETY CHAR(1),
FP_EMPEROR CHAR(1),
FP_SX1 CHAR(1),
FP_CEL CHAR(1),
LP_CHANNEL VARCHAR2(255),
LP_DATE DATE,
LP_DYNASTY CHAR(1),
LP_MOVIE CHAR(1),
LP_FUN CHAR(1),
LP_LEARNING CHAR(1),
LP_NEWS CHAR(1),
LP_SPORTS CHAR(1),
LP_VARIETY CHAR(1),
LP_EMPEROR CHAR(1),
LP_SX1 CHAR(1),
LP_CEL CHAR(1));
--truncate table RPT1120B_CHANNEL;
create or replace PROCEDURE sp_rpt1120b_new
AS
FP_CHANNEL VARCHAR2(255);
FP_DATE DATE;
LP_CHANNEL VARCHAR2(255);
LP_DATE DATE;
REC_COUNT NUMBER(3);
TYPE REC_SA IS RECORD
(AGREEMENT_NO NUMBER (9));
TYPE REC_CHANNEL IS RECORD
(CHANNEL VARCHAR2(3),
AGREEMENT_NO NUMBER (9));
BEGIN
FOR REC_SA IN (SELECT DISTINCT SUBSCRIBER_NO FROM RPT1120B_T1_new) LOOP
FP_CHANNEL := '';
LP_CHANNEL := '';
REC_COUNT := 0;
FP_DATE := '';
LP_DATE := '';
FOR REC_CHANNEL IN (SELECT distinct decode(SOC,
29990,'N',
29991,'V',
29993,'M',
29988,'F',
29989,'L',
29992,'S',
29994,'D',
29995,'E',
30277,'C',
30293,'C',
30319,'C',
30359,'C',
30276,'X',
30331,'X',
30299,'X',
30380,'X')
AS CHANNEL,SA.EFFECTIVE_DATE as soc_sts_date
FROM SERVICE_AGREEMENT SA
WHERE SA.SOC in ( 29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380) AND
SA.AGREEMENT_NO = REC_SA.SUBSCRIBER_NO AND
TRUNC(SA.EFFECTIVE_DATE) <> TRUNC(NVL(SA.EXPIRATION_DATE,SYSDATE)) AND
SA.EFFECTIVE_DATE = (SELECT MIN(SA1.EFFECTIVE_DATE) FROM SERVICE_AGREEMENT SA1
WHERE SA1.AGREEMENT_NO = SA.AGREEMENT_NO AND
sa1.soc in (
29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380))
order by DECODE(channel,'D',1,'M',2,'E',3,'C',4,'X',5,'F',6,'L',7,'N',8,'S',9,'V',10)) LOOP
REC_COUNT := REC_COUNT + 1;
if REC_COUNT < 254 then
FP_CHANNEL := FP_CHANNEL || REC_CHANNEL.CHANNEL;
end if;
FP_DATE := REC_CHANNEL.soc_sts_date;
END LOOP;
REC_COUNT := 0;
FOR REC_CHANNEL IN (SELECT distinct decode(sa.SOC,
29990,'N',
29991,'V',
29993,'M',
29988,'F',
29989,'L',
29992,'S',
29994,'D',
29995,'E',
30277,'C',
30293,'C',
30319,'C',
30359,'C',
30276,'X',
30331,'X',
30299,'X',
30380,'X')
AS CHANNEL,SA.soc_status_date as soc_sts_date
FROM SERVICE_AGREEMENT SA,
(SELECT MAX(SA1.soc_status_DATE) as soc_date, agreement_no, soc
FROM SERVICE_AGREEMENT SA1
WHERE soc in( 29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380)
GROUP BY agreement_no, soc) sa1
WHERE SA.SOC in ( 29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380) AND
SA.soc_status_date = sa1.soc_date AND
TRUNC(SA.SOC_STATUS_DATE) <> TRUNC(NVL(SA.EXPIRATION_DATE,SYSDATE)) AND
SA.SOC_STATUS = (SELECT MIN(SA2.SOC_STATUS) FROM SERVICE_AGREEMENT SA2
WHERE SA2.AGREEMENT_NO = SA.AGREEMENT_NO AND sa2.soc = sa.soc
and SA2.soc_status_date = SA.soc_status_date)
order by DECODE(channel,'D',1,'M',2,'E',3,'C',4,'X',5,'F',6,'L',7,'N',8,'S',9,'V',10)) LOOP
REC_COUNT := REC_COUNT + 1;
if REC_COUNT < 254 then
LP_CHANNEL := LP_CHANNEL || REC_CHANNEL.CHANNEL;
end if;
LP_DATE := REC_CHANNEL.soc_sts_date;
END LOOP;
INSERT INTO RPT1120B_CHANNEL_new values
(REC_SA.SUBSCRIBER_NO,
substr(FP_CHANNEL,1 essageID=1196758, I have hit with above error and the code did run successfully before the minor change in the portion I have bolded. Appreciate your comment & help.
Attached with the code:
CREATE TABLE RPT1120B_CHANNEL_new
(SUBSCRIBER_NO NUMBER (9),
FP_CHANNEL VARCHAR2(255),
FP_DATE DATE,
FP_DYNASTY CHAR(1),
FP_MOVIE CHAR(1),
FP_FUN CHAR(1),
FP_LEARNING CHAR(1),
FP_NEWS CHAR(1),
FP_SPORTS CHAR(1),
FP_VARIETY CHAR(1),
FP_EMPEROR CHAR(1),
FP_SX1 CHAR(1),
FP_CEL CHAR(1),
LP_CHANNEL VARCHAR2(255),
LP_DATE DATE,
LP_DYNASTY CHAR(1),
LP_MOVIE CHAR(1),
LP_FUN CHAR(1),
LP_LEARNING CHAR(1),
LP_NEWS CHAR(1),
LP_SPORTS CHAR(1),
LP_VARIETY CHAR(1),
LP_EMPEROR CHAR(1),
LP_SX1 CHAR(1),
LP_CEL CHAR(1));
--truncate table RPT1120B_CHANNEL;
create or replace PROCEDURE sp_rpt1120b_new
AS
FP_CHANNEL VARCHAR2(255);
FP_DATE DATE;
LP_CHANNEL VARCHAR2(255);
LP_DATE DATE;
REC_COUNT NUMBER(3);
TYPE REC_SA IS RECORD
(AGREEMENT_NO NUMBER (9));
TYPE REC_CHANNEL IS RECORD
(CHANNEL VARCHAR2(3),
AGREEMENT_NO NUMBER (9));
BEGIN
FOR REC_SA IN (SELECT DISTINCT SUBSCRIBER_NO FROM RPT1120B_T1_new) LOOP
FP_CHANNEL := '';
LP_CHANNEL := '';
REC_COUNT := 0;
FP_DATE := '';
LP_DATE := '';
FOR REC_CHANNEL IN (SELECT distinct decode(SOC,
29990,'N',
29991,'V',
29993,'M',
29988,'F',
29989,'L',
29992,'S',The error message has an important hint: "number precision too large"
Change REC_COUNT's type from NUMBER(3) to NUMBER and see what happens.
Maybe you are looking for
-
Reading cache values from iView properties
Hi, I want to programmatically retrieve the value of an iView's cache properties. I was thinking of retrieving this the normal way, using the attributes of the IPcdContext object. This works for most attributes, for instance: <b>pcdContext.getAttribu
-
Can I over-ride the default setting in Organizer to allow sorting photos by filename ?
I am converting slides from the 1970's and 80's to digital files and using PSE 8 to Organize them but it is important to me that they stay in the order of the file name I give them and NOT "Date: newest first or last" because it would seem that PSE,
-
I can't take my Visa card off of my account. Why is this?
I Can't take my Visa card off of my account. Why is this?
-
No Sound. Speaker "on" "off" button not functioning
I have an HP Pavillion Laptop which was purchased in the last 9 months. Don't know what kind of sound board is installed. Running Windows 8. Upgraded to Windows 8.1 last week and now I don't have any sound. When I press the Speaker "On/Off" button
-
How can I import psd photos from Elements into iPhoto?
I cannot import psd photos into iPhoto without saving them to the desktop, which is a real hassle (hundreds of photos). Am I doing something incorrectly? Thanks for any advice.