unable to select image from remote database - oracle

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.

Related

Oracle CLOB data type to Redshift data type

we are in the process of migrating Oracle tables to redshift tables. We found that few tables are having CLOB data type. In redshift we converted CLOB to Varchar(65535) type. While doing copy command , we are getting
The length of the data column investigation_process is longer than the length defined in the table. Table: 65000, Data: 90123.
Which data type we need to use? Please share your suggestion.
Redshift isn't designed to store CLOB (or BLOB) data. Most databases that do store the CLOB separately from the table contents to not burden all queries with the excess data. A CLOB reference is stored in the table contents and a replacement of CLOB for reference is performed at result generation.
CLOBs should be stored in S3 and references to the appropriate CLOB (S3 key) stored in the Redshift table. The issue is that there isn't a prepackaged tool for doing the CLOB for reference replacement with Redshift AFAIK. Your solution will need some retooling to perform this replacement actions for all data users. It's doable, it's just going to take a data layer that performs the needed replacement.

Oracle Managed Data Access Bulk Copy Error pasing insert statement for table (virtual columns)

We've recently moved to use Oracle.ManagedDataAccess in our application now it supports Bulk Copy. The problem is it seems to have a hard time dealing with tables that have virtual columns where the unmanaged client did not.
Oracle.ManagedDataAccess.Client.OracleException: 'ORA-02373: Error parsing insert statement for table SFOL.BUILDRECORD.
ORA-54013: INSERT operation disallowed on virtual columns'
The specific error above seems to suggest that it doesn't like the DataTable provided but the DataTable clearly specifies the columns and does not include any virtual columns. The underlying table itself does have virtual columns but we're not inserting into them.
The database is Oracle 19c and the ManagedDataAccess client is 19.10.0
Any ideas?

How to solve ORA-22992: cannot use LOB locators selected from remote tables?

I have created a DB link and I created a local synonym to the remote table. I also created a local view that selects data from the synonym. A blob column has been added to the remote table and I am unable to select it locally.
This is how my code looks like:
CREATE OR REPLACE VIEW LOCAL_USER.VIEW AS (
SELECT
WHATEVER,
BINARY_CONTENT
FROM LOCAL_USER.LOCAL_TABLE
UNION ALL
SELECT
WHATEVER,
BINARY_CONTENT
FROM LOCAL_USER.SYNONYM
);
and this is the error:
ORA-22992: cannot use LOB locators selected from remote tables
I looked it up online, but the proposed solutions would not work for me cause I am using a synonym, that needs to be up to date with the remote table at all time.
Does anyone have an idea of what can be done about it?
According to Documentation, this usage of LOB is not supported.
Oracle Database has limited support for remote LOBs and ORA-22992
errors can occur when remote LOBs are used in ways that are not
supported.
And creating views with remote LOBs are not on the list of supported operations as per the documentation above.
On Oracle support I found a document 796282.1 for older version of database (12.1) with workaround, but this workaround seems very limited as it consist of converting CLOB/BLOB into VARCHAR2/RAW via support function and then accessing it remotely. This of course adds to limitation for VARCHAR2 at 4000 bytes and for RAW at 2000 bytes, which can be quite limiting.

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.

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