Reputation: 800
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:
Upvotes: 1
Views: 95
Reputation: 168681
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
Upvotes: 0
Reputation: 22467
Double click on the value. You'll see your data.
Or, you can tell SQL Developer to show those values by default.
Preferences > Advanced, display structures
And then run your query again.
[
Upvotes: 1