Confusion of length of column data type
Hi all
To learn about my column data type and length, I have run the following query. However, when I confirm it with the table_name desc command, I see that the lengths of data do not correspond. You have an idea?
> > select column_name | » '|| DATA_TYPE | » ('|| ( data_length|') ' col_info all_tab_columns where table_name = 'CUSTTABLE' and column_name = 'ACCOUNTNUM;
> > ACCOUNTNUM NVARCHAR2 (24)
> > desc CUSTTABLE.
> > ACCOUNTNUM 1 N NVARCHAR2 (12)
Concerning
Charlie
NightWing wrote:
By the way I couln t understand what were you thinking when you explain to no.
I missed you NVARCHAR2 column and thought it was VARCHAR2. When you declare the semantics of VARCHAR2 column length is specified explicitly or implicitly. Explicitly suffixing length with BYTE or CHAR and implicitly when you specify the length of the right itself. Then length is based on the value NLS_LENGTH_SEMANTICS session. So let's assume you generate table create statement (and it seems that you is, based on column_name |) » '|| DATA_TYPE | » ('|| ( data_length|') ' ). Then it does not matter if use use data_length or char_col_decl_length. It will be regadless semantics implied length of what you use. Therefore, when you run create table instructions column length will be interpreted as bytes if current NLS_LENGTH_SEMANTICS byte value. But same length is interpreted as the characters if current NLS_LENGTH_SEMANTICS a char value. As you can see, in order to generate create table statement we use explicit semantic length column, otherwise create table statement can produce lengths of different column in the source table.
SY.
Tags: Database
Similar Questions
-
length of the data type of a column
Hello
I would like to know if it is possible to find the length of the
data type in a create table stmt.
For example:
create employee table (empno number (3), empname varchar (10));
in the DDL above I mentioned the size of my 3 number data type.
is there a way to retrieve this info. ?
outside desc < table_name >?
Thanks in advanceSQL> create table employee(empno number(3),empname varchar(10)) 2 / Table created. SQL> select column_name 2 , data_length 3 , data_precision 4 , data_scale 5 from user_tab_columns 6 where table_name = 'EMPLOYEE' 7 / COLUMN_NAME DATA_LENGTH DATA_PRECISION DATA_SCALE ------------------------------ ----------- -------------- ---------- EMPNO 22 3 0 EMPNAME 10 2 rows selected.
Details on the columns can be found in the documentation: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2094.htm#I1020277
Kind regards
Rob. -
Column data type not supported
Hello
I have Oracle 12 c installed in my system. I created an SP that returns a Table when I try to run it in SQL Developer, it gives me the correct results, but when I call it my DOTNET application it gives me the error-'datatype of the column unsupported. I'm trying to fill a dataset using a data adapter. To check I commented all the code in the procedure and returned the table using the code below.
Declare rc sys_refcursor; Begin OPEN rc FOR SELECT 'Sayam' AS "Error" FROM dual; SYS.DBMS_SQL.RETURN_RESULT (rc, TRUE) ; END;
But the problem was still same. This is the track of the same thing.
Oracle.ManagedDataAccess.Client.OracleException took
HResult =-1450
Message = data type of column not supported
Source = Oracle Data Provider for .NET, pilot managed
ErrorCode =-1450
DataSource =""
Number =-1450
Procedure =""
StackTrace:
at Oracle.ManagedDataAccess.Client.OracleParameter.PreBind (OracleConnectionImpl connImpl, ColumnDescribeInfo cachedParamMetadata, Boolean, bMetadataModified, Int32 arrayBindCount, ColumnDescribeInfo, paramMetaData, object & paramValue, Boolean isEFSelectStatement)
at OracleInternal.ServiceObjects.OracleCommandImpl.InitializeParamInfo (ICollection paramColl, OracleConnectionImpl connectionImpl, ColumnDescribeInfo cachedParamMetadata [], Boolean & bMetadataModified, isEFSelectStatement Boolean, MarshalBindParameterValueHelper & marshalBindValuesHelper)
to OracleInternal.ServiceObjects.OracleCommandImpl.ProcessParameters (OracleParameterCollection paramColl, OracleConnectionImpl connectionImpl, ColumnDescribeInfo cachedParamMetadata [], Boolean, bBindMetadataModified, isEFSelectStatement Boolean, MarshalBindParameterValueHelper & marshalBindValuesHelper, Boolean & bAllInputBinds)
at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader (String commandText, OracleParameterCollection, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl paramColl & rdrImpl, longFetchSize of Int32, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, scnForExecution of Int64 [], Int64 [] scnFromExecution, OracleParameterCollection, internalInitialLOBFS, OracleException & exceptionForArrayBindDML, Boolean isDescribeOnly, Boolean isFromEF, Boolean bBindParamPresent, Int64 & bindByPositionParamColl)
at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader (Boolean requery, fillRequest Boolean, CommandBehavior behavior)
to Oracle.ManagedDataAccess.Client.OracleDataAdapter.Fill (DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, command IDbCommand, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill (DataSet dataSet)
at DataAccessLayer.DataAccessService.OracleGetData_Load (String SPName, XElement QueryParam, Exception & e, Boolean bFlag) in d:\Sayam\April\Multiplay\DataAccessLayer\DataAccessLayer\DAS.cs:line 187
Please let me know if I need to change anywhere.
Thank you
Siradji
Hello
I did a search for two days and found the link below to set up the DLL
http://www.Oracle.com/technetwork/database/Windows/downloads/index-090165.html
It worked well when installing using CMD
Thank you.
-
XMLTable: definition of the columns data type of table
Hello world
I am using ORACLE 11 g and you want to shred XML into a table called test used. I was hoping I'd be able to get the types of data to the employees table existing instead of specify them in the clause of columns. Is this possible?
Here is an example of what I'm trying to do. But I get an error: PL/SQL: ORA-00907: lack the right parenthesis on the line starting with columns.
Error detailsinsert into EMPLOYEES select * from xmltable( '/employees/employee' passing EMP_XML columns FIRST_NAME EMPLOYEES.FIRST_NAME%TYPE path 'first_name', LAST_NAME EMPLOYEES.LAST_NAME%TYPE path 'last_name', GENDER EMPLOYEES.GENDER%TYPE path 'gender', AGE EMPLOYEES.AGE%TYPE path 'age' );
Thank you.columns FIRST_NAME EMPLOYEES.FIRST_NAME%TYPE path 'first_name', * ERROR at line 16: ORA-06550: line 16, column 42: PL/SQL: ORA-00907: missing right parenthesis ORA-06550: line 11, column 5: PL/SQL: SQL Statement ignored
Specification of column names is required, but you can omit the declaration of data types.
See: the function XMLTABLE SQL/XML in Oracle XML DB
XMLTable is used with storage XML based on a schema of XMLType data type is optional. If absent, the data type is inferred from the XML schema. If Oracle > XML DB is unable to determine the right type of a node, a default type VARCHAR2 (4000) is used.
It is an Oracle extension; in the SQL/XML standard, the data type is always required.
Note:
The alleged data type might change as a result of the application of a patch or upgrade of Oracle XML DB. In particular, a new set of release or patch might be able to > determine the data type when the previous version was unable to do so (and therefore not reimbursed to VARCHAR2 (4000)). To protect against such an eventuality, specify an explicit data type with the data type. -
Database application - direct incorrect column data type
Hello all-
hope you can help with this. I use the live database request in Oracle BI to send a complex query directly to our data warehouse. My problem is that the columns of results containing my measurements are converted by Oracle BI so they should be double. The conversion of integer causes decimals to round values, reading to incorrect results in my reports. I tried several tweeks to my request to allow OBIEE correct estimate on the data type, but nothing has worked.
Is there a way to force OBIEE to recognize the correct data type for a column in a query request to the live database?
Thanks in advance for you help!
MacClick here for a solution using the cast function:
http://gerardnico.com/wiki/dat/OBIEE/direct_database_request_table_function#oracle_number_data_type_as_an_integerSee you soon
Nico -
Timestamp for date columns data type are not imported in discoverer admin
Hi all
Someone you will suggest why timestamp data type columns are not imported into admin. discoverer other types of data import you correctly, but the timestamp data type columns are missed.
Please let me know to change the type of data is not possible at this time.
Thank youHello
You will be disappointed because the timestamp columns are not one of the recognized data types supported by the discoverer. He acknowledges only dates, strings and (integer and decimal) numbers.Maybe you could put up a view that matches the table you use, convert the timestamp in a rather ordinary date?
Then, inside your end-user license, all you would have to do is redirect the folder to view.
Best wishes
Michael -
ODI 12 - problem with missing data in the store column data types
Hello world
We have recently installed Studio 12 on Oracle RDBMS ODI. We have created some topologies, contexts and the logical architecture. We have created the necessary templates and made reverse engineering. The strange thing is when a model data store opening, we have noticed, the data types of its attributes are not displayed and cannot be selected in the drop-down list because they do not exist yet. You can see the image below.
So the mappings are not correctly executed because on the stage of the creation of work tables CREATE script was not generated correctly. (It's something like "CREATE TABLE < name > ()")
Anyone can give an idea what could be the reason for this and how might be solved?
Any ideas would be appreciated.
Thank you in advance.
Hello
Please see the links below this should help you.
http://gerardnico.com/doc/ODI/Webhelp/en/refmanual/topology/snpdt.htm
http://gerardnico.com/doc/ODI/Webhelp/en/UserManual/topology/topology/topo_reverse_datatypes.htm
http://odiexperts.com/data-types-creating-what-is-missing-for-any-technology/
-
query on the column data type CLOB display part of instruction. Why?
Hi all
Why when I have queries on the CLOB column display only part of instruction.
as follows
drop table test_clob;
create table test_clob (number (9) id, article clob);
insert into test_clob values (1,' 1. Quality and perfection: the international quality
standards, including port of commitment and discipline,
and to discover the best of the features that cater to the
charity society has been able to get the most important
International certificates in achieving quality, administrative, industrial and food. ") ;
SQL > select * from test_clob;
ARTICLE ID
---------- ----------------------------------------
1-1. Quality and perfection: the boarding school
international quality
standards, including what
but in the request of me don't show that part of the statement
concerning
Waelset long 5000
-
Supported or not supported data Type Confusion
Hello
Before starting my goldengate installation and initial load, I ran full - DB_CheckOracle_12072011.sql to my database source according to the MOS ID 1379932.1.
Here are the following results (does not include everything):
---------
# Separate column data types and their number in the schema:
DATA type TOTAL
BLOB * 4 *.
CHAR * 381 *.
CLOB * 3 *.
DATE * 11832 *.
LONG * 18 *.
NCHAR * 1 *.
NUMBER * 30255 *.
NVARCHAR2 * 35 *.
GROSS * 12 *.
ROWID * 4 *.
TIMESTAMP (6) * 2 *.
UNDEFINED * 124 *.
VARCHAR2 * 48047 *.
# Tables with constraints of deferred payment. Deferred constraints can cause TRANDATA to choose an incorrect key SP2-0552: Bind "B0" undeclared variable.
# Tables set with the size of > 2M line in all schemas
# Tables with number primary key or a Unique Index and column length > 1 M
# Tables with CLOB, BLOB, LONG, NCLOB or LONG RAW columns in all schemas
OWNER TABLENAME DATA type
PR_COLLMAIN ALLOC_TEST LONG
PR_COLLMAIN BOD_TEST LONG
--------
Question:
LONG (1) is included in the list of goldengate data types supported, how is this report shows that the following tables (with long data_type) will do my TRANDATA to choose an incorrect key?
Thanks in advance!
Mela
Published by: 840534 on February 25, 2013 23:46
Published by: 840534 on February 25, 2013 23:46There is no link between "chose an incorrect key SP2-0552: Bind variable undeclared" B0"AND"LONG tables of data type"both are different results, there are two distinct sqls are executed in the database for"# Tables with constraints of payment deferred"AND"# Tables with CLOB, BLOB, LONG, NCLOB or LONG RAW columns in all schemas.
# - These symbols are used for each query result comment line.
This means,
# Tables with constraints of deferred payment. Deferred constraints can cause TRANDATA to choose an incorrect key SP2-0552: Bind "B0" undeclared variable.
no selected line
# Tables set with the size of > 2M line in all schemas
no selected line
# Tables with number primary key or a Unique Index and length 1 M column >
no selected line
# Tables with CLOB, BLOB, LONG, NCLOB or LONG RAW columns in all schemas
THE DATA OWNER TABLENAME TYPE
PR_COLLMAIN ALLOC_TEST LONG
PR_COLLMAIN BOD_TEST LONGIf you open this file and read 'full - DB_CheckOracle_12072011.sql' you can see the sqls separated for each control and output results.
Finally, there are no Tables with constraints carried forward in your database that will impact Trandata.
HTH
Annamalai.
-
How can I find what is the data type of a column of a Table in oracle or SQL?
(a) what happens if I want to know the type of data in a specific column in the Table.
(b) how to find the column data types?
Can someone help me please. I am new to oracle and try to learn a few tricks
Hello
How to do
SQL > desc
SQL> desc emp Name Null? Type ----------------------------------------- -------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2)
-
Hi all
We can overload subprogrammes that setting differ in the number, order, and type of family data. But impossible to overload if the parameter differs only in the void type.
If I see the standard package, I get
subtype types BINARY_FLOAT is NUMBER;
subtype BINARY_DOUBLE is NUMBER;
But I am able to overload the two procedures, we have a parameter types binary_float and binary_double other. They are of subtype of the same data type. that is the number. So, how is it possible. Also, most of the subtypes have no difference. So, why are there these number of subtypes? Oracle defines subtypes as data type with some sort of constraint on the base data type, but is valid for all? for example, smallint, and decimal.
type of NUMBER is NUMBER_BASE;
subtype of FLOAT is NUMBER;
ACTUAL subtype is FLOAT;
subtype 'DOUBLE PRECISION' is FLOAT;
INTEGER subtype is NUMBER (38.0).
subtype INT is INTEGER;
subtype SMALLINT is NUMBER (38.0).
DECIMAL subtype is NUMBER (38.0).
DIGITAL subtype is DECIMAL;
DEC subtype is DECIMAL;>
We can overload subprogrammes that setting differ in the number, order, and type of family data. But impossible to overload if the parameter differs only in the void type.If I see the standard package, I get
subtype types BINARY_FLOAT is NUMBER;
subtype BINARY_DOUBLE is NUMBER;But I am able to overload the two procedures, we have a parameter types binary_float and binary_double other. They are of subtype of the same data type. that is the number. So, how is it possible. Also, most of the subtypes have no difference. So, why are there these number of subtypes? Oracle defines subtypes as data type with some sort of constraint on the base data type, but is valid for all? for example, smallint, and decimal.
type of NUMBER is NUMBER_BASE;
subtype of FLOAT is NUMBER;
ACTUAL subtype is FLOAT;
subtype 'DOUBLE PRECISION' is FLOAT;
INTEGER subtype is NUMBER (38.0).
subtype INT is INTEGER;
subtype SMALLINT is NUMBER (38.0).
DECIMAL subtype is NUMBER (38.0).
DIGITAL subtype is DECIMAL;
DEC subtype is DECIMAL;
>
Some of those who, as a smallint, SQL ANSI data types. See table 2-6 ANSI Datatypes converted to Oracle data types in the doc of the SQL language
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/sql_elements001.htmOracle allows the name of the ANSI data type to use and combines the name of the ANSI for the appropriate Oracle data type
>
ANSI SQL/DS and DB2 data typesThe SQL statements that create tables and clusters allows also ANSI data types and products IBM SQL/DS and DB2 data types. Oracle recognizes the ANSI or IBM data type name that differs from the Oracle database data type name. It converts the data type for the equivalent Oracle data type, stores the Oracle data type under the name of the column data type and stores the data in the column in the data type Oracle based on the conversions listed in the following tables.
>
But BINARY_FLOAT and BINARY_DOUBLE types are each defined as unique data types (see table 2-1 in this doc).Because they are unique Oracle data types, they can be overloaded.
-
FRM-41335: Populate_List: invalid column for column 1 type
Hello world
I can't fill my list item file. I use Oracle Forms 6i, running on windows 64-bit
Here is my code.
DECLARE
REPORT NUMBER;
list_id POINT;
BEGIN
set_item_property ('spn.lst_year_annual', visible, property_true);
set_item_property ('spn.lst_year_annual', enabled, property_true);
list_id: = Find_Item ('spn.lst_year_annual');
-to fill the
STATUS: = POPULATE_GROUP ('RG_YEAR_RANGE');
-Make sure that the select statement is executed successfully.
CLEAR_LIST (list_id);
POPULATE_LIST (list_id, 'RG_YEAR_RANGE');
END;
Here's my query for RG_YEAR_RANGE group
Select years, years
v $ year_range
v$ year_range view query
SELECT ((TO_CHAR (SYSDATE, 'YYYY') + 1) - ROWNUM) years
OF object where rownum < = 20PoPList column data types are VARCHAR2. Make sure you cast it explicitly your columns to the query of VARCHAR2 using the function TO_CHAR.
select TO_CHAR(years), TO_CHAR(years) from v$year_range
Craig...
-
-Error ORA-00932: inconsistent data types: expected TANK got the NUMBER
Here is my report query...
The column data type RFA_FLAG is NUMBER(*,0)... I'm view RSA and RSA - not the area of selection, but I get the error ORA-00932: inconsistent data types: expected TANK got the NUMBER >select * from DW_RFA_JOBDATA where FINISH_TIME >= :P1_START_DATE and FINISH_TIME < :P1_END_DATE AND RFA_FLAG = (CASE :P1_JOB_CLASSIFICATION WHEN '0' THEN 'LSF' WHEN '1' THEN 'NON-LSF' ELSE RFA_FLAG END)
I have created a static LOV with LST display 0 return
Display NON - RSA 1 return...
Could any body please help me in truble shooting error? How to to convert the data type to number, I have no privileges to make changes to the table...Mark you my previous answer as correct? (MOST POINTS! :))
-
Hi all
I use Oracle 10.2.
I had a table contains one column. data type is BLOB.
When I run the select query I get error like:
SQL > select * from BRIEF_ALL;
SP2-0678: column Type or attribute can not be displayed by SQL * more
SQL > desc BRIEF_ALL;
Name Null? Type
----------------------------------------- -------- ----------------------------
CONTENT BLOB
Thank youSP2-0678: column Type or attribute can not be displayed by SQL * more
Upgrade of SQL * Plus 11.1.0.7:
SQL> create table t (bl) as select to_blob(utl_raw.cast_to_raw('Hello world')) from dual 2 / Table created. SQL> SQL> desc t Name Null? Type ----------------------------------------- -------- ---------------------------- BL BLOB SQL> select * from t 2 / BL -------------------------------------------------------------------------------- 48656C6C6F20776F726C64 SQL>
For older versions, you can try
select utl_raw.cast_to_varchar2(bl) bl from t
-
Change the length of a Table column (CHAR data type)
Hi gurus,
SQL > select * from version $ v
BANNER
----------------------------------------------------------------
Oracle Database 10g Release 10.2.0.3.0 - 64 bit Production
PL/SQL version 10.2.0.3.0 - Production
CORE Production 10.2.0.3.0
AMT for Linux: release 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
I need to increase the length of a CHAR of a table data type column (currently it's tank (3) and you want to change to char (4)). Here are more details on the table:-
- Contains more than 20 million lines.
- Table contains several indexes.
- Table is referenced by several tables (about 60 tables) and it refers to several tables (about 3)
- Table has 4 complex triggers. Triggers call procedures and packages.
What I've tried so far
1 disabled all triggers and ran ALTER statement to increase the length. It took hours and did not finish in a reasonable amount of time, even if no error, but it took more than 12 hours.
2 tried DBMS_REDEFINITION package but it does not work with the standard version of Oracle 10 g.
I think to try next
I think same Optics:
Say my name of the existing table is OLD_T1 where the length of column need to increase
-Create a copy (with increased column length) table of OLD_T1, Say NEW_T1
-Move data from in OLD_T1 to the new table NEW_T1
-Lower OLD_T1 (or rename it to OLD_T1_TMP)
-Rename NEW_T1 to OLD_T1
-Create all indexes, triggers, constraints etc..
I wish to confirm, if my approach is correct? Or someone has a better idea to do this?
Please note: I know that the CHAR data type gives the problem but it is an old system and I don't have authority to change the design of database.
Appreciate any comment/suggestion
Thanks in advance
> I mean, can any application break if it depends on fixed-length?
Yes, because the code can be expected completed on the right areas.
Maybe you are looking for
-
Impossible to update my itunes
When I try to update my itunes I get the following message is displayed: Cannot install the updated "iTunes." The file 'iTunesX.pkg' could not be found on the server "swcdn.apple.com". This is preview of my computer. Presentation of the material: Mod
-
Microsoft Windows 7 KB2454826 update
When this update has been installed, the PC has restarted and I go into Windows Explorer, in my FAVORITES folder, if I try to open any icon (for example, My Computer, System folder etc) I get the following message appears. "This file doesn't have an
-
I can't understand the use and intention live wireless. I have the name of my HP7520 and in the manual it says to "seek and connect" on behalf of live wireless. How one search, and from a Smartphone, connect you to the printer? What tool or applicati
-
Access selected programs update privilege on Windows XP profiles
I know there is a way to install Windows XP with an administrator account and multiple limited access account and allow some programs like antivirus, adobe flash, java, Skype, etc., access access or admin to install the updates for this specific prog
-
The service settings not complete
The parameters of the service shows that "Airplane Mode" and "network" Mode Normally, it should show a lot more. (Need to increase the level of the microphone for audio recording)