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

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.

Related

Is there any performance loss when using ANSI data types in 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.

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.

Query JSONB through dblink (Oracle <> Postgres)

We have a local db (Oracle) where we want to query a remote db (postgres), the data to be retreived is in JSONB format.
What is the best way for achieving this ?
The tool for accessing PostgreSQL from Oracle database is GoldenGate.
The 12.2 documentation does not even list the jsonb data type, so it is probably is not supported (I guess Oracle didn't check PostgreSQL's documentation since 9.2, when json was introduced).
But then Oracle doesn't have a special JSON data type anyway, it stores JSON as VARCHAR2 or CLOB, so you can easily use a view in PostgreSQL that casts the jsonb to text and use that.

unable to select image from remote database

I m accessing remote database through DBLINK, but when trying to fire select query to fetch image stored in BLOB datatype it gives me following error:
ORA-22992: cannot use LOB locators selected from remote tables
Thanks in Advance.
You didn't provide the statement you are trying to execute, but I guess you are trying to do something which simply isn't possible in Oracle 10g.
The docs at http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements001.htm#sthref161 state:
Oracle Database has limited support for remote LOBs. Remote LOBs are
supported in three ways.
Create table as select or insert as select.
Functions on remote LOBs returning scalars. SQL and PL/SQL functions having a LOB parameter and returning a scalar datatype are
supported. Other SQL functions and DBMS_LOB APIs are not supported for
use with remote LOB columns.
Data Interface for remote LOBs. You can insert a character or binary buffer into a remote CLOB or BLOB, and select a remote CLOB or
BLOB into a character or binary buffer.
These are the only supported syntax involving LOBs in remote tables.
No other usage is supported.
See the link for extended examples.
To access data of type BLOB use the PIC datatype. Build your query like this:
*select(
**select PIC from AGENT_SIGNATURES_TB#DBLINK**
) as PIC
from dual*
At least that worked for me on an Oracle database.

Store cyrillic in Oracle

I have Oracle database with following settings
NLS_CHARACTERSET EE8MSWIN1250
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_LANGUAGE AMERICAN
I've created test table with one column of type NVARCHAR2, where I'm going to store cyrillic.
I use SQL Developer to connect DB.
The problem is when I put a cyrillic chain into DB using SQL Developer cell, the data is stored correctly. But when I use INSERT query with the same data using N'' or not the data is stored as question marks.
Interesting thing is that query generated by SQL Developer, and written by me is identical.
I solved this problem by changing NLS_CHARACTERSET to UTF8, but on production server I can't do such a thing.
IMO it must be some way to store cyrillic into that DB in proper way using query if SQL Developer can do that.
Regards
Depending on the ODBC/JDBC in use, localization settings on your computer may override any config values in the database. Try using ALTER SESSION and set the proper NLS parameters before executing your query, and see if that helps. SQL developer might do this behind the scenes when you edit the data cell.

Resources