Is there any performance loss when using ANSI data types in Oracle? - oracle

If I use any ANSI supported data types like INTEGER, NUMERIC, REAL etc., as a data type for a column, or a variable in PL/SQL, will it have an additional cost for the database?
What are the pros and cons for using the ANSI supported data types in Oracle database? (Database Version: 19c)

ANSI data-types are just aliases for Oracle data types and will be converted to the equivalent Oracle data type.
From the documentation:
ANSI, DB2, and SQL/DS Data Types
SQL statements that create tables and clusters can also use ANSI data types and data types from the IBM products SQL/DS and DB2. Oracle recognizes the ANSI or IBM data type name that differs from the Oracle Database data type name. It converts the data type to the equivalent Oracle data type, records the Oracle data type as the name of the column data type, and stores the column data in the Oracle data type based on the conversions shown in the tables that follow.
ANSI SQL Data Type
Oracle Data Type
NUMERIC[(p,s)]DECIMAL[(p,s)] (Note 1)
NUMBER(p,s)
INTEGERINTSMALLINT
NUMBER(38)
FLOAT (Note 2)DOUBLE PRECISION (Note 3)REAL (Note 4)
FLOAT(126)FLOAT(126)FLOAT(63)
What are the pros and cons for using the ANSI supported data types in Oracle database?
There are no performance benefits or penalties as the type will be converted to the equivalent Oracle type. The main benefit would be the portability of code between different RDBMS.

Related

Edit RAW column in Oracle SQL Developer

I am using Oracle SQL Developer 18.3 but when I want to edit(or insert) a column with RAW datatype it shows the field as read only and does not allow to edit.
As you may know Oracle SQL Developer shows RAW datatype as hex string despite BLOB datatype that it does not show the value but you can download and upload the BLOB data.
I know that I can update(or insert) the RAW data as hex string like this :
CREATE TABLE t1(the_id NUMBER PRIMARY KEY, raw_col RAW(2000));
INSERT INTO t1(the_id, raw_col) VALUES(1, '1a234c');
But I want do it by Oracle SQL Developer GUI.
Sorry, we do not have a 'raw' editor like we have for BLOBs, so it's up to using SQL.
If you want a reason for that omission, it's partly due to the fact that RAW is not a commonly used data type in Oracle Database.
Related: if you're talking about LONG RAW
We (Oracle) recommend you stop using it, and instead convert them to BLOBs.
The LONG RAW datatype is provided for backward compatibility with
existing applications. For new applications, use the BLOB and BFILE
datatypes for large amounts of binary data. Oracle also recommends
that you convert existing LONG RAW columns to LOB columns. LOB columns
are subject to far fewer restrictions than LONG columns. Further, LOB
functionality is enhanced in every release, whereas LONG RAW
functionality has been static for several releases.

What's the ST_GEOMETRY type in Oracle?

Table Description is...
COLUMN NAME / DATA TYPE
------------------------------------------
MNUM VARCHAR2(33)
ALIAS VARCHAR2(200)
REMARK VARCHAR2(200)
NTFDATE VARCHAR2(8)
SGG_OID INTEGER
COL_ADM_SECT_CD VARCHAR2(5)
OBJECTID INTEGER
**SHAPE ST_GEOMETRY**
Does anybody know about Spatial information processing?
First of all, One of column's type in oracle is "ST_GEOMETRY" .
What is this kind of type?
And how can we migrate these kind of data to other oracle databse system?
ST_GEOMETRY is not native Oracle type. It is spatial type developed by esri and apparently it is installed on top of oracle database. I would assume that some ArcGIS products are using this database.
You can read more about this type in esri documentation. http://desktop.arcgis.com/en/arcmap/10.3/manage-data/gdbs-in-oracle/stgeometry-oracle.htm
The previous answer is misleading since it describes SDO Geometry which is another completely different spatial type developed by Oracle.
ST_GEOMETRY is a spatial data type. The use of the data type along with other supported data types are part of Oracle database's spatial technology. Apparently ST_GEOMETRY is also part of an ISO standard that Oracle supports.
You can migrate these objects and other data from Oracle database to database using data pump.
Oracle Spatial
Oracle Spatial Data Pump

Liquibase column data types from generateChangeLog

I have two databases, one on DB2 and one on ORACLE. I've generated change log file via generateChangeLog command. It produced me correct xml file, but only on Oracle database. I was invoking this command on oracle database and in result I got in column data types like NUMBER(*,0) which are not valid on DB2. How can I generateChangeLog with unified data types in liquibase ?
Does some list of data types exists in liquibase ? Which are let's say versitale to all databases ??
Reverse engineering an existing DB schema to a Liquibase XML file always creates the DBMS specific datatypes. You will have to edit the generated XML file to use JDBC types.
The supported "cross-platform" types are documented in the manual:
http://www.liquibase.org/documentation/column.html
To help make scripts database-independent, the following “generic” data types will be converted to the correct database implementation:
BOOLEAN
CURRENCY
UUID
CLOB
BLOB
DATE
DATETIME
TIME
BIGINT
Also, specifying a java.sql.Types.* type will be converted to the correct type as well. If needed, precision can be included. Here are some examples:
java.sql.Types.TIMESTAMP
java.sql.Types.VARCHAR(255)
From my experience the first list is missing INTEGER and DECIMAL which can also be used without problems (at least for Oracle and Postgres - don't have DB2 around to test it).

What Oracle data type is easily converted to BIT in MSSQL via SSIS?

I have a Data Flow from an Oracle table to an MSSQL table with one field of data type BIT. The Oracle table is using the characters Y and N at the moment (I'm unsure of the data type and have no way of checking), but the MSSQL table needs to be data type BIT. What type of cast can I use on the Oracle query so that the data is pulled smoothly over?
Use char(1) and then use a derived column transformation like this:
(DT_BOOL)(OracleField == "Y"?1:0)
Give this column a name like OracleFieldAsBool
and then use it instead of the original column in the rest of your data flow.

How to read NCLOB, CLOB data values from Oracle database using Classic ASP pages?

I am getting the following error:
Microsoft OLE DB Provider for Oracle: Data type is not supported.
Could somebody help me figure out this please...
Situation:
Recently migrated database from SQL Server 2005 to Oracle 11g. One of the table has some columns of the data type ntext in SQL Server, which were converted to NCLOB during migration to Oracle. Client is Classic ASP page (VBScript) accessing the Oracle Database through OLEDB connection.
When the execution reaches the query (Select query) that reads the column of type NCLOB it is throwing the Microsoft OLE DB Provider for Oracle: Data type is not supported error. When I take out that particular column then the query is running fine...
QUESTION: How to read NCLOB, CLOB data values from Classic ASP pages?
Plz let me know if you need more information.....
Thank You..
I know that Microsoft's ODBC Driver for Oracle didn't support any of the LOB types-- I would wager that its OLE DB Provider didn't either given the error. Can you upgrade to the Oracle OLE DB Provider?
As an aside, since you are migrating from SQL Server to Oracle, do you really need to use the NCLOB data type? Since Oracle allows the database character set to be Unicode, you normally don't need (and don't want) to use the NVARCHAR2 or NCLOB data types unless you're stuck supporting an old database that requires a non-Unicode character set. For data that is English or Western Eurpoean in nature, storing data in a CLOB has substantial benefits in terms of storage space since the CLOB would store the data in UTF-8 rather than UTF-16 in an NCLOB (assuming that you picked a Unicode character set for the database). Eliminating the NVARCHAR2 and NCLOB columns also tends to make it much easier for front-end tools to handle the data.

Resources