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

REF operator #92

Open
Lurgrid opened this issue Nov 6, 2024 · 6 comments
Open

REF operator #92

Lurgrid opened this issue Nov 6, 2024 · 6 comments

Comments

@Lurgrid
Copy link

Lurgrid commented Nov 6, 2024

Hello,

When I run a query that has the operator REF() I get an error Error: unknown Oracle type number 0.

Exemple

SELECT REF(X) 
FROM INTERVENANT X 
WHERE X.MAT = 1000;

Here is the doc for REF()

https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/REF.html

@Lurgrid
Copy link
Author

Lurgrid commented Nov 6, 2024

I've just noticed that if a table contains an element of type REF TYPE then I can't display it.

CREATE TYPE MISSION_TYPE AS OBJECT (
    CODE VARCHAR2(64),
    INTITULE VARCHAR2(64),
    NB_JOURS INTEGER,
    INTERVENANT REF INTERVENANT_TYPE
);

CREATE TABLE MISSION
OF MISSION_TYPE (
    CONSTRAINT PK_CODE PRIMARY KEY (CODE)
);

SELECT * FROM MISSION

I get the same error Error: unknown Oracle type number 0.

@cjbj
Copy link

cjbj commented Nov 7, 2024

What is INTERVENANT_TYPE defined as?

Likely an ODPI-C limitation.

@kubo
Copy link
Owner

kubo commented Nov 7, 2024

REF data type isn't supported by rust-oracle. It is an ODPI-C limitation as @cjbj mentioned.

Oracle Call Interface (OCI) supports it. Its data type code is SQLT_REF. ODPI-C converts the OCI data type code to Oracle type number in dpiOracleType__convertFromOracle. However SQLT_REF isn't handled in the function and it returns (dpiOracleTypeNum)0. So the error is Error: unknown Oracle type number 0.

@cjbj
Copy link

cjbj commented Nov 8, 2024

@Lurgrid were you just testing REF, or do you have a business need for support?

@Lurgrid
Copy link
Author

Lurgrid commented Nov 8, 2024

Yes it happened during a normal use of my program. But if that's not possible, I can at worst use the sqlplus binary directly and convert its responses.

@cjbj
Copy link

cjbj commented Nov 8, 2024

I can't predict when our ODPI-C or @kubo's rust-oracle will support the feature, but I have noted your vote for it.

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

No branches or pull requests

3 participants