1

I try to do some stuff wie object relational Databases. I have Oracle Express and the SQL Developer. Everything works fine.

I can create my own, custom types and insert some rows. The problem is that it would not be display right. I think it is normally because they should be display object/types in a column...

Is there a solution to display the objects in the columns?

This is my code. p.s. i am from germany. ANSCHRIFT_T is a type for an address with name of the tress (Strasse) and house number (Hausnr).

CREATE OR REPLACE TYPE ANSCHRIFT_T AS OBJECT (STRASSE CHAR(12), HAUSNR CHAR(3));

CREATE TABLE VERTRETER(V_NR NUMBER(4) PRIMARY KEY, ANSCHRIFT ANSCHRIFT_T);

INSERT INTO VERTRETER VALUES (1, ANSCHRIFT_T('TESTWEG','14'));
INSERT INTO VERTRETER VALUES (2, ANSCHRIFT_T('BLA BLA WEG', '25'));

SELECT V_NR, ANSCHRIFT FROM VERTRETER;

But the output its just this:

enter image description here

2 Answers 2

1

Double click on the value. You'll see your data.

double click in the bracketed text

Or, you can tell SQL Developer to show those values by default.

Preferences > Advanced, display structures

Turn this on

And then run your query again.

[Voila[3]

Sign up to request clarification or add additional context in comments.

Comments

0

You need to add an alias for the table name and then you can select the values from the object column using table_alias.object_column.object_attribute. Like this:

Query:

SELECT V_NR,
       v.ANSCHRIFT.STRASSE,
       v.ANSCHRIFT.HAUSNR
FROM   VERTRETER v;

Output:

      V_NR ANSCHRIFT.STRASSE ANSCHRIFT.HAUSNR
---------- ----------------- ----------------
         1 TESTWEG           14               
         2 BLA BLA WEG       25               

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.