hocam bütün DDL i kopyaliyorum...
Kod: Tümünü seç
CREATE GENERATOR GEN_RECHNUNG_ID;
CREATE TABLE RECHNUNG (
RECHNUNG_ID BIGINT NOT NULL,
SB BIGINT,
RGNR BIGINT,
KUNDEN_ID BIGINT,
DATUM DATE,
BETRAG DECIMAL(15,2),
ZHANREDE VARCHAR(4),
ZHTITEL VARCHAR(15),
ZHNACHNAME VARCHAR(20),
ZHVORNAME VARCHAR(20),
ZHNAME COMPUTED BY (case when (zhtitel) is null and (zhnachname) is null and (zhvorname) is not null then
'z.H.'||' '||zhanrede||' '||zhvorname
when (zhtitel) is null and (zhnachname) is not null and (zhvorname) is null then
'z.H.'||' '||zhanrede||' '||zhnachname
when (zhtitel) is null and (zhnachname) is not null and (zhvorname) is not null then
'z.H.'||' '||zhanrede||' '||zhnachname||' '||zhvorname
when (zhtitel) is not null and (zhnachname) is null and (zhvorname) is not null then
'z.H.'||' '||zhanrede||' '||zhtitel||' '||zhvorname
when (zhtitel) is not null and (zhnachname) is not null and (zhvorname) is null then
'z.H.'||' '||zhanrede||' '||zhtitel||' '||zhnachname
when (zhtitel) is not null and (zhnachname) is not null and (zhvorname) is not null then
'z.H.'||' '||zhanrede||' '||zhtitel||' '||zhnachname||' '||zhvorname end),
O_STRASSE VARCHAR(30),
O_PLATZ INTEGER,
O_ORT VARCHAR(15),
O_ADRESSE COMPUTED BY (case when (o_strasse) is null and (o_platz) is null then
o_ort
when (o_strasse) is null and (o_ort) is null then
o_platz
when (o_strasse) is null and (o_platz) is not null and (o_ort) is not null then
o_ort||' '||o_platz
when (o_strasse) is not null and (o_platz) is null and (o_ort) is null then
o_strasse
when (o_strasse) is not null and (o_platz) is null and (o_ort) is not null then
o_ort||', '||o_strasse
when (o_strasse) is not null and (o_platz) is not null and (o_ort) is null then
o_platz||', '||o_strasse
when (o_strasse) is not null and (o_platz) is not null and (o_ort) is not null then
o_platz||' '||o_ort||', '||o_strasse end),
MWST SMALLINT,
ZAHLUNG SMALLINT,
ABLAGE VARCHAR(10),
LZ DATE,
FUR VARCHAR(100),
SKONTO FLOAT DEFAULT 0,
STORNO SMALLINT DEFAULT 0,
ZSUMME COMPUTED BY (case when (skonto is not null) and (mwst is not null) and (betrag is not null) then
((100 - skonto) / 100) * betrag else 0 end),
RSKONTO COMPUTED BY (case when (skonto is not null) and (betrag is not null) then
(skonto / 100) * betrag else 0 end),
RMWST COMPUTED BY (case when (skonto is not null) and (mwst is not null) and (betrag is not null) then
((((100 - skonto) / 100) * betrag) / 100) * mwst
when (skonto is null) and (mwst is not null) and (betrag is not null) then
(betrag / 100) * mwst else 0 end),
BRUTTO COMPUTED BY ((((100 + mwst) / 100)) * ((((100 - skonto) / 100) * betrag)))
);
/******************************************************************************/
/**** Primary Keys ****/
/******************************************************************************/
ALTER TABLE RECHNUNG ADD CONSTRAINT PK_RECHNUNG PRIMARY KEY (RECHNUNG_ID);
/******************************************************************************/
/**** Triggers ****/
/******************************************************************************/
SET TERM ^ ;
yukarida belirttigin sekilde de denedim fakat sonuc yine ayni. 970 veriyor...