简体   繁体   中英

OR Database/Type in Oracle Express/SQL Developer

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. ps 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:

在此处输入图片说明

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.

[ 瞧[3]

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               

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM