Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPI-1014: conversion between Oracle type 2005 and native type 3004 is not implemented #187

Open
tgulacsi opened this issue Nov 13, 2024 · 4 comments
Labels

Comments

@tgulacsi
Copy link

  1. What version of ODPI-C are you using (see dpi.h)?
    5.4.0

  2. What OS (and version) is your application on?
    Debian sid

  3. What compiler (and version) did you use?
    gcc 14.2.0

  4. What is your version of the Oracle Client (e.g. Instant Client)? How was it installed? Where it is installed?
    oracle-instantclient-basic_23.6.0.24.1

  5. What is your Oracle Database version?
    19.23

  6. What problem or error(s) you are seeing?
    DPI-1014: conversion between Oracle type 2005 and native type 3004 is not implemented

This is correct - I want to dpiObject_setAttribute an attribute that has ROWID type.
Oracle does not provide an "OCICharToRowid" function (a'la OCIRowidToChar) - but how could I set such an attribute?

@anthony-tuininga
Copy link
Member

Can you share the type and how it was created? Is this a PL/SQL type? I tried with a named type and it wouldn't allow me to create a type containing a ROWID attribute.

@tgulacsi
Copy link
Author

Yes, it is a PL/SQL record type, with one attribute defined as ROWID:

CREATE PACKAGE test AS
  TYPE rowid_rt IS RECORD (
    id PLS_INTEGER,
    row_id ROWID
  );
END;

dpiObject_setAttribute..., "ROW_ID", ...) returns this error.

My gut feeling is that the intention was to disallow generating/injecting invalid/fake/bogus rowids into the system,
but this asymmetry (getAttribute automatically converts the rowid to a string, but setAttribute forbids the backward conversion) is not nice.
The worst part is that I can use rowid-as-a-string in SQL statements (and everywhere) as a rowid.

@tgulacsi
Copy link
Author

I've tried the same trick as in #186:

DECLARE
  v_obj DB_GFB_MENESZT.PARTNER_REC_TYPE := :1;
BEGIN
  v_obj.ROW_ID := :2;
  :3 := v_obj;
END;

with obj, "-16", &obj
but got

ORA-03113: DPI-1080: connection was closed by
        ORA-03113: end-of-file on communication channel
        Process ID: 21636
        Session ID: 75 Serial number: 63909
        Help: https://docs.oracle.com/error-help/db/ora-03113/

instantly.

In PL/SQL, I can set that v_obj.row_id to anything, so this must be getting such an object from the db with OCI.

@tgulacsi
Copy link
Author

tgulacsi commented Nov 19, 2024

DECLARE
  v_obj BRUNO_OWNER.DB_GFB_MENESZT.PARTNER_REC_TYPE := :1;
  v_rowid CONSTANT VARCHAR2(128) := :2;
--or v_rowid ROWID := :2;
BEGIN
  v_obj.ROW_ID := v_rowid;
  :3 := v_obj;
END;

with "AAAkvKAAeAACtIDAA" string as :2: ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]

I have no more ideas.

(I can live with it, it seems implausible to have to transfer a rowid from a database and use it in another one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants