Hi All,
I have created a view with the definition below - please be patient, it's not as hairy as it looks at first). The problem here is I can create the view, but when I try to select on the view I get a "ORA-00907: missing right parenthesis" error. I also get this error if I try to run the SQL separately. I'm confused because the statement is not that complicated. If I run the part in red, it runs fine...
This one really has me pulling my hair out. If anyone can give any insight/suggestions, I'd really appreciate it.
TIA,
Sven
SELECT
acct.acctcd AS acctcd,
upper(acct.acctdsc) AS acctshortnm,
coalesce(chsup.chcd,' ') AS chcd,
upper(coalesce(chsup.chshortnm,' ')) AS chshortnm,
coalesce(chsup.schcd,' ') AS schcd,
upper(coalesce(chsup.schshortnm,' ')) AS schshortnm,
SYSDATE AS effdt
FROM
acct acct
LEFT JOIN
(SELECT
acctcd,
acctshortnm,
src,
chcd,
chshortnm,
schcd,
schshortnm
FROM
((SELECT
ch.chcd AS chcd,
ch.chshortnm AS chshortnm,
s.schcd AS schcd,
s.schshortnm AS schshortnm,
s.schcd AS acctcd,
s.schshortnm AS acctshortnm,
'S' AS src
FROM Cch ch
LEFT JOIN
chs s
ON ch.schcd=s.schcd )
UNION ALL (
SELECT ch.chcd AS chcd,
ch.chshortnm AS chshortnm,
s.schcd AS schcd,
s.schshortnm AS schshortnm,
ch.chcd AS acctcd,
ch.chshortnm AS acctshortnm,
'C' AS src
FROM ch ch
LEFT JOIN
chs s
ON ch.schcd=s.schcd) ) x
WHERE acctcd IS NOT NULL) [/color red]
chsup ON acct.acctcd = chsup.acctcd
I have created a view with the definition below - please be patient, it's not as hairy as it looks at first). The problem here is I can create the view, but when I try to select on the view I get a "ORA-00907: missing right parenthesis" error. I also get this error if I try to run the SQL separately. I'm confused because the statement is not that complicated. If I run the part in red, it runs fine...
This one really has me pulling my hair out. If anyone can give any insight/suggestions, I'd really appreciate it.
TIA,
Sven
SELECT
acct.acctcd AS acctcd,
upper(acct.acctdsc) AS acctshortnm,
coalesce(chsup.chcd,' ') AS chcd,
upper(coalesce(chsup.chshortnm,' ')) AS chshortnm,
coalesce(chsup.schcd,' ') AS schcd,
upper(coalesce(chsup.schshortnm,' ')) AS schshortnm,
SYSDATE AS effdt
FROM
acct acct
LEFT JOIN
(SELECT
acctcd,
acctshortnm,
src,
chcd,
chshortnm,
schcd,
schshortnm
FROM
((SELECT
ch.chcd AS chcd,
ch.chshortnm AS chshortnm,
s.schcd AS schcd,
s.schshortnm AS schshortnm,
s.schcd AS acctcd,
s.schshortnm AS acctshortnm,
'S' AS src
FROM Cch ch
LEFT JOIN
chs s
ON ch.schcd=s.schcd )
UNION ALL (
SELECT ch.chcd AS chcd,
ch.chshortnm AS chshortnm,
s.schcd AS schcd,
s.schshortnm AS schshortnm,
ch.chcd AS acctcd,
ch.chshortnm AS acctshortnm,
'C' AS src
FROM ch ch
LEFT JOIN
chs s
ON ch.schcd=s.schcd) ) x
WHERE acctcd IS NOT NULL) [/color red]
chsup ON acct.acctcd = chsup.acctcd