Veröffentlicht 28. November 200618 j Hi, ich habe folgende Typen und Tabellen: create type station_t as object ( id number(3), x number(4), y number(4) ); / create type verbindung_t as object ( ref_station ref station_t, verkehrsmittel varchar2(8) ); / create type verbindungen_t as table of verbindung_t; / --Erstelle eine typisierte Tabelle station_tab und fülle die Tabelle1 mit Instanzen vom Typ station_t CREATE TABLE station_tab OF station_t ( id PRIMARY KEY, x NOT NULL, y NOT NULL ); show errors; alter type station_t add attribute verbindungen verbindungen_t cascade; CREATE TYPE spieler_t AS object ( farbe VARCHAR2(15), ref_startstation REF station_t, taxi NUMBER(2), bus NUMBER(2), ubahn NUMBER(2) ); / CREATE TABLE spieler_tab OF spieler_t ( farbe PRIMARY KEY, ref_startstation NOT NULL, taxi NOT NULL, bus NOT NULL, ubahn NOT NULL ); show errors; alter type spieler_t add attribute verbindungen verbindungen_t cascade; Nun möchte ich in spieler_tab Daten einfügen: INSERT INTO spieler_tab VALUES ( 'blau', station_t ( (SELECT ref(s) FROM station_tab s WHERE id = 121), (SELECT x FROM station_tab WHERE id = 121), (SELECT y FROM station_tab WHERE id = 121), verbindungen_t() ), 10, 8, 5, verbindungen_t() ); Meldung: (SELECT ref(s) FROM station_tab s WHERE id = 121), * FEHLER in Zeile 5: ORA-00932: Inkonsistente Datentypen: NUMBER erwartet, REF xxx.STATION_T erhalten Ok, dann so (er will ja NUMBER): INSERT INTO spieler_tab VALUES ( 'blau', station_t ( (SELECT id FROM station_tab s WHERE id = 121), (SELECT x FROM station_tab WHERE id = 121), (SELECT y FROM station_tab WHERE id = 121), verbindungen_t() ), 10, 8, 5, verbindungen_t() ); Doch dann kommt diese Meldung: station_t * FEHLER in Zeile 3: ORA-00932: Inkonsistente Datentypen: REF xxx.STATION_T erwartet, xxx.STATION_T erhalten Jetzt erwartet er genau das, was er oben erhalten hat... Woran liegt das?
29. November 200618 j Ok, hat sich erledigt. Habe den fehler gefunden... INSERT INTO spieler_tab VALUES ( 'rot', (SELECT ref(s) FROM station_tab s WHERE id = 74), 10,8,5,verbindungen_t() );
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.