Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Probleme wegen ref()

Empfohlene Antworten

Veröffentlicht

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?

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.