Can anyone tell me what is wrong with this sql statement. Everytime I try to execute it, it hangs up.
CREATE OR REPLACE VIEW "MDR_VIEW" ("NIIN","D_DDR",
"D_MDR","R_DDR","R_MDR","MDR","MDR_SOURCE" AS
SELECT
m.niin,
d.d_ddr,
d.d_mdr,
r.r_ddr,
r.r_mdr,
CASE
when d.d_mdr>r.r_mdr THEN
d.d_mdr
when r.r_mdr>d.d_mdr THEN
r.rbl_mdr
when r.r_mdr=d.d_mdr THEN
d.d_mdr
ELSE
0
END CASE,
CASE
when d.d_mdr>r.r_mdr THEN
'DA'
when r.r_mdr>d.d_mdr THEN
'RBL'
when r.r_mdr=d.d_mdr and r.r_mdr <> 0 THEN
'DA'
ELSE
'USER'
END CASE
FROM
R_MDR_VIEW r,
D_MDR_VIEW d,
MASTER_NIIN m
WHERE
r.niin(+) = m.niin
AND m.niin = d.niin(+)
CREATE OR REPLACE VIEW "MDR_VIEW" ("NIIN","D_DDR",
"D_MDR","R_DDR","R_MDR","MDR","MDR_SOURCE" AS
SELECT
m.niin,
d.d_ddr,
d.d_mdr,
r.r_ddr,
r.r_mdr,
CASE
when d.d_mdr>r.r_mdr THEN
d.d_mdr
when r.r_mdr>d.d_mdr THEN
r.rbl_mdr
when r.r_mdr=d.d_mdr THEN
d.d_mdr
ELSE
0
END CASE,
CASE
when d.d_mdr>r.r_mdr THEN
'DA'
when r.r_mdr>d.d_mdr THEN
'RBL'
when r.r_mdr=d.d_mdr and r.r_mdr <> 0 THEN
'DA'
ELSE
'USER'
END CASE
FROM
R_MDR_VIEW r,
D_MDR_VIEW d,
MASTER_NIIN m
WHERE
r.niin(+) = m.niin
AND m.niin = d.niin(+)