SQL & PL/SQL :: Number Datatype Size Can't Decreased
Mar 22, 2010
In my table there is column with number datatype of size col1 number(15,3) and my data in column is like
001
002
003
and i am changing its size to number(10,3) by alter table command but it not allowing. why?????? as my data in that column still satisfy the the changes.
and even when i modify the char column to varchar2 column by alter table command and changing the size of that column,it is not allowing me to change it why?
View 30 Replies
ADVERTISEMENT
May 24, 2012
I want to decrease the size of testid column of number datatype in my "test" named table from size 20 to 15 and the data of maximum size is of 10 digits. but oracle throws an error "ORA-01440: column to be modified must be empty to decrease precision or scale". i cant understand why it is happening?
what is the reason behind it even though new size is maximum than the maximum size of existing data. but when i decrease the size of "varchar2" then oracle does not through any error.
View 3 Replies
View Related
Sep 18, 2012
i have altered the sga_max_size to 2gb.i found the system free memory is also decreased.Is system free memory changes when sga_max_size is changes?
View 1 Replies
View Related
Dec 21, 2010
The below table and functions are examples, but issue is like this.
i have one issue while forming below sql , Application will form this query at run time wih required inputs
it is failing because the application will not support the clob datatype.
Table : T_E (similar to EMP table structure)
This table has data similar to emp but bulk data around 10k records.
Query formed
select empno,ename, get_employees(deptno)
from t_e;
This sql query this is failing when function return varchar2 string more than 4000 size.Because in sql query size should not exceed 4000 for varchar2 data type , function return size can be upto 20000
Function which
CREATE OR REPLACE FUNCTION get_employees (p_deptno in emp.deptno%TYPE)
RETURN varchar2
IS
l_text varchar2(32767) := NULL;
BEGIN
FOR cur_rec IN (SELECT ename FROM t_e WHERE deptno = p_deptno) LOOP
l_text := l_text || ',' || cur_rec.ename;
END LOOP;
RETURN LTRIM(l_text, ',');
END;
I can try this with clob but application doesn't support that..so i tried with using clob in above function , after that while returning to application i want to conver the clob to char and return the entire string
select empno,ename, to_char(substring(get_employees(deptno),1,4000)) -- first 4000 characters
, to_char(substring(get_employees(deptno),4000,8000)) -- next 4000 characters
from t_e;
But this is failing how to return the entire string in above sql
View 1 Replies
View Related
Nov 14, 2012
i am trying to calculate the avg size of a row, in which i have one column which has clob datatype,
for rest of the datatypes i am using (avg(vsize(col_name,varchar2(10)))), i want a simple function that can calculate the clob datatype.
View 12 Replies
View Related
Jun 27, 2013
Can we apply LPAD in NUMBER datatype?
View 11 Replies
View Related
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
Mar 8, 2011
I have a Number(18,0) datatype.It could have millions/billions stored in that field.How can I show that amount in the form of $7,123,787 ($ sign and commas)?
By using To_char function like below, I am not getting the desired format.
Select to_char(123000000.25, '$9,9999999999.00') FROM dual;
Result is (no commas):
$123000000.25
View 2 Replies
View Related
May 29, 2013
I am facing issue related to Number data while it is being converted to Varchar2, it is automatically getting rounded off after 32 decimal place.My database version is "Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production".
1) create table test18 ( col1 varchar2(10), val Number);
create table succeeded.
2) insert into test18 values ('First', -347026.6408499652467480885711448714129679); -- After decimal 34 digits
1 rows inserted
insert into test18 values ('Second', -347026.64084996524674808857114487141296); -- After decimal 32 digits
1 rows inserted
3) select * from test18;
COL1 VAL
---------- ----------------------
First -347026.6408499652467480885711448714129679
Second -347026.64084996524674808857114487141296
4) As per the requirement, all the columns would need to be concatenated as a single string along with comma delimiter
select col1 || ',' || val as record_string
from test18;
RECORD_STRING
---------------------------------------------------
First,-347026.64084996524674808857114487141297
Second,-347026.64084996524674808857114487141296
"First" string got rounded off to 97 (last 2 digits) instead of 9679 but for "Second" record it holds the actual value.Only thing which I could figure out while the number is getting type casted to String, it is getting rounded off to 32 decimal place.throw off some light on it and provide the solution how the original record can be kept intact without rounding off.
Expected Output_
RECORD_STRING
---------------------------------------------------
First,-347026.6408499652467480885711448714129679
Second,-347026.64084996524674808857114487141296
View 10 Replies
View Related
Nov 15, 2013
Database Version : DB : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionOS : HP-UX nduhi18 B.11.31 U ia64 1022072414 unlimited-user licenseAPP : SAP - ERP I have to RANGE partition on UPDATED_ON or PROFILE either one table which is having below
structure : Name Null? Type
-------------------- -------- --------------------------------
MANDT NOT NULL VARCHAR2(9) MR_ID NOT NULL VARCHAR2(60) PROFILE NOT NULL VARCHAR2(54) REGISTER_ID NOT NULL VARCHAR2(30) INTERVAL_DATE NOT NULL VARCHAR2(24) AGGR_CONSUMPTION NOT NULL NUMBER(21,6) MDM_VERS_NO NOT NULL VARCHAR2(9) MDP_UPDATE_DATE NOT NULL VARCHAR2(24) MDP_UPDATE_TIME NOT NULL VARCHAR2(18) NMI_CONFIG NOT NULL VARCHAR2(120) NMI_CONFIG_FLAG NOT NULL VARCHAR2(3) MDM_DATA_STRM_ID NOT NULL VARCHAR2(6) NSRD NOT NULL VARCHAR2
[Code]....
As per my knowledge, RANGE is better suited for DATE or NUMBER. and INTERVAL partition is possible on DATE or NUMBEr . Column PROFILEIts is of VARCHAR2 datatype. I know still I can partition as Oracle internally convert varchar2 to number while inserting data. But INTERVAL is not possible. How to RANGE partition on PROFILE ? Column CREATED_ON :It is of NUMBER with decimal
View 0 Replies
View Related
Aug 17, 2012
I would need to convert the column datatype from BLOB to CLOB. currently in the table, the BLOB column has the data. the requirement is to convert this column from BLOB to CLOB datatype.
How to convert from BLOB datatype to CLOB datatype ?
View 10 Replies
View Related
May 8, 2013
We are planning to export the table data to a file pipedelimited. How do i estimate the size of the FlatFile based on the table size? or avg rowlength
View 3 Replies
View Related
Apr 13, 2011
I am using oracle 8.1.5 database and my temp01.dbf file size is increased upto 19.8 GB now i want reduce its size .
View 13 Replies
View Related
Oct 4, 2012
i was using sql server there is time keyword but in oracle which keyword i should take instead of time keyword?
View 7 Replies
View Related
Nov 23, 2011
I created a table of Number(20,4) column. I inserted an amount value 999999999999999.5555 but this value is rounded off to 1000000000000000.0000 automatically in Oracle. How to avoid this? I tried for less number of digits and I am getting the exact value. Is there any way to get the exact value without changing the datatype?
View 1 Replies
View Related
Jul 20, 2011
I am using Anchored datatype wheere the table_name which lies in another schema and the current scheam has select insert update delete access on the the said table of the schema.
Example in current schema LL_TAR
I have defined a varaible in a script/procedure
V_TAG LL_TMR.TAG_DETAILS.TAG_VAL%type where TAG_VALUE column lies in a table TAG_DETAILS which lies
in LL_TMR.
During compilation it gives me an error PLS-00904 saying insufficient privilege. This issue and still use anchored datatype.Or anchored datatype of tables which lie in different schema on the same database server is not allowed? Cause i had read that on some websites that it is allowed for a table which resides on a different schema on a database.
View 3 Replies
View Related
Dec 8, 2010
I have created an Object Type and this Type is mapped to a column datatype in a table.This Table has values inserted.
create or replace
type column_type as object (
col_name varchar2(30),
col_comment varchar2(4000)
);
[code]....
ORA-02303: cannot drop or replace a type with type or table dependents...how to resolve this issue without having to delete any column from the table?
View 2 Replies
View Related
Feb 21, 2012
I have a table in my database with a column called theme_night_date that i want to store just a date and no time.
View 2 Replies
View Related
Sep 1, 2010
Can we use long data type in where clause of the query ?
View 2 Replies
View Related
Feb 21, 2010
I have a table which have almost 90000 rows.
1. The datatype of some columns is NVARCHAR2. I want to change it to VARCHAR2 and NUMBER for some.
View 5 Replies
View Related
Jul 12, 2013
Query that I want to run:
exec DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES', false);
result: E;;45;45 ;45 ;45 ;S 45
I am not sure but may be I need to set long size before running above query. But when I try to set long size gives below error. "The output from DBMS_METADATA.GET_DDL is a LONG datatype. When using SQL*Plus, your output may be truncated by default. Issue the following SQL*Plus command before issuing the
DBMS_METADATA.GET_DDL statement to ensure that your output is not truncated:"SQL> SET LONG 9999error: Unhandled SET statement: "SET LONG 9999"
View 5 Replies
View Related
Aug 31, 2012
I've this problem:
create table t1 ( x long );
Table created.
create table t2 ( x long );
Table created.
insert into t1 values ( 'test long type' );
1 row created.
insert into t2 select * from t1;
*
ERROR at line 1:
ORA-00997: illegal use of LONG datatype
How can I issue this error, I need use also dblink with long type.
I do not want to use the copy command.
I know that you can solve this problem with a stored procedure or anonymous block.
View 8 Replies
View Related
Jul 31, 2013
on this query. I need to get a particular value from a column which is a BLOB datatype. Here is the sample
data ID TESTDATA1 Best Buy
00001234 12222 30 00 2
Lowes 00001234 12222 100 00 3
Walmart 00001234 12222 129 00 4
abc 00001234 12222 5000 00 5
Toshiba 00001234 12222 21 00 6
abcdefghij 00001234 12222 49 00
Where '00001234' is the Invoice , '12222' is Netamount field and highlighted in red is the $ amount for that invoice.
The only data i need query to return 12222 (netamount)= $amount. I tried using substr select substr((TESTDATA),19,26)test from TABLEA; But this gives me the only the first row but not other amount which have different positions.
Here is the desired output
OutputID TESTDATA 1
12222 30 2 12222 100 3
12222 129 4 12222 5000 5
12222 21 6 12222 49
View 11 Replies
View Related
Nov 1, 2011
I am updating a table column which is xml datatype and am getting above error.Below is the process what i did. since the xml is too large i split them into small chunks.
DECLARE
conditionXML CLOB;
ls_xml_2 Clob;
ls_xml_3 clob;
ls_xml_4 Clob;
ls_xml_5 Clob;
ls_xml_6 clob;
ls_xml_7 Clob;
[code]...
View 1 Replies
View Related
Aug 16, 2010
how can i update CLOB values in Oracle? I am passing string values to Clob datatype from .Net Eg '13223311','12122112','122125552'
View 6 Replies
View Related
Feb 1, 2012
I have a source data in a column with LONG datatype. I want to insert that data into a separate table in a column which has BLOB datatype.
View 9 Replies
View Related
Oct 14, 2012
i am running one query which is here
INSERT INTO shiftsample (Empid, PPDate, Inpunch, outpunch)( SELECT Emp_ID, PDate, In_Punch, Out_Punch FROM ProcessDailyData WHERE PDate = to_char(2012-10-15,'yyyy-MM-dd') AND Emp_ID = '00000001' );
in this query pdate has timestamp datatype and in shift sample ppdate column has date type. so i am not able to insert value from process daily data table.
getting this error.
SQL Error: ORA-01481: invalid number format model
01481. 00000 - "invalid number format model"
*Cause: The user is attempting to either convert a number to a string
via TO_CHAR or a string to a number via TO_NUMBER and has
supplied an invalid number format model parameter.
View 19 Replies
View Related
Oct 12, 2012
i am having one column name pdate with date datatype
i am updating here value like this
update table1 set pdate='15-10-2012' where id=1;
but showing error: not a valid month.
how to update this.
View 7 Replies
View Related
Mar 13, 2013
How to get max and min value from a varchar2 datatype column?
CREATE TABLE TEST
(
WEIGHT VARCHAR2(20)
);
INSERT INTO TEST VALUES('100');
INSERT INTO TEST VALUES('120');
INSERT INTO TEST VALUES('113');
INSERT INTO TEST VALUES('145');
INSERT INTO TEST VALUES('204');
INSERT INTO TEST VALUES('130');
I've to find the max and min weight from this data.
View 2 Replies
View Related
Apr 27, 2010
I have question related to LONG datatype. Actually from google and get to know that one table can have only one LONG datatype when i searched for reason . i got these resons:-
With 9i (I believe) and later versions, Oracle deprecates using the long datatype in favor of the lob (clob, nclob and blog) datatypes. It is only supported for backward compatibility.
Restriction:- It can not be used in create type as an attribute of the defined type.
It can not be used in where conditions.
There can be no indexes on long columns.
Regular Expression are not possible.
long can not be returned from a stored function.
SQL can not call functions that have an attribute of type long.
And even more restrictions.
So I want to know that is only reason because of that Oracle doesn't allow us to make two Column or is there any strong reason which make it more logical Like storing of data in Row blocks or some thing else.
View 2 Replies
View Related