473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SQL0104N Error

Hi,

I am getting the following error when i am trying to create a view. But if i run the select statement independently it is working fine. Please help me it is very urgent.

15:06:08.043 DBMS FFIDWD -- Error: [IBM][CLI Driver][DB2/SUN] SQL0104N An unexpected token "DW" was found following "SAN' FOR CREATE VIEW". Expected tokens may include: "JOIN". SQLSTATE=42601

Please find the SQL for creating the view. Please tell me what the error is....


CREATE VIEW DW.GC_CLIENT_HQ_SUMMARY AS
SELECT * FROM
(SELECT
CURRENT_MONTH_VALUE, PREVIOUS_MONTH_VALUE, PREVIOUS_YEAR,CURRENT_YEAR,Team_Name AS "Global Cash Sales Team",
Salesperson_Name,col_order,
SUM("Spot Assets") AS "Spot Assets",
SUM("Current Spot Assets") AS "Current Spot Assets",
SUM("Current Spot Assets") - SUM("Spot Assets") AS "Spot Assets YTD Change",
SUM("Prior Year Avg Assets") AS "Prior Year Avg Assets",
SUM("YTD Avg Assets") AS "YTD Avg Assets",
SUM("YTD Avg Assets") - SUM("Prior Year Avg Assets") AS "YTD Average Change"
FROM
(SELECT
CURRENT_MONTH_VALUE, PREVIOUS_MONTH_VALUE, PREVIOUS_YEAR,CURRENT_YEAR,Team_Name , Salesperson_Name,col_order,
SUM(FACT_PREV_YEAR.closing_balance_USD) AS "Spot Assets",
cast(0.0 as decimal(19,4)) AS "Current Spot Assets",
cast(0.0 as decimal(19,4)) AS "Spot Assets YTD Change",
SUM(FACT_PREV_YEAR.average_balance_USD) AS "Prior Year Avg Assets",
cast(0.0 as decimal(19,4)) AS "YTD Avg Assets",
cast(0.0 as decimal(19,4)) AS "YTD Average Change"
FROM
CONTROL.DATA_WAREHOUSE_CURRENT_DATE CONTROL_DATE,
DW.DIMENSION_MUTUAL_FUND DIM_MF,
(
SELECT
(Case
when y.avenue_client_id = 'M305610' then y.Name
when y.avenue_client_id != 'M305610' and coalesce(y.sub_channel,'') = 'State Pools' then y.sub_channel
when s.team_name = 'US Corporate and Public Sector' or s.team_name = 'US Financial Institutions'
then 'US Sales'
when s.team_name = 'Europe Corporate and Financial Institutions' then 'Europe Sales'
when s.team_name = 'Asia Corporate and Financial Institutions' then 'Asia Sales'
else
s.team_name
end) as Team_Name ,Salesperson_Name, Fund_account_DK,
(case
when y.avenue_client_id = 'M305610' or y.avenue_client_id != 'M305610'
and coalesce(y.sub_channel,'') = 'State Pools' then 2
else
1
end) as Col_order
FROM dw.dimension_salesperson s,
dw.dimension_mutual_fund_account x,
dw.dimension_avenue_client y
WHERE salesperson_id = x.HQ_salesperson_ID
AND x.avenue_client_id = y.avenue_client_id
AND Team_Name IS NOT NULL AND s.END_DATE IS NULL
AND FUND_ACCOUNT_DK NOT in (SELECT FUND_ACCOUNT_DK FROM DW.FILTER_REPORT_VW FR
WHERE FR.FILTER_CODE ='GBLCASHVW'
AND FUND_ACCOUNT_DK IS NOT NULL
)
) AS ACCT_SALESPEOPLE INNER JOIN DW.FACT_YEARLY_MF_AUM FACT_PREV_YEAR on
FACT_PREV_YEAR.fund_account_dk = ACCT_SALESPEOPLE.Fund_account_DK
WHERE DIM_MF.MUTUAL_FUND_DK NOT IN (SELECT MUTUAL_FUND_DK FROM DW.FILTER_REPORT_VW FR
WHERE FR.FILTER_CODE ='GBLCASHVW'
AND MUTUAL_FUND_DK IS NOT NULL
)
AND FACT_PREV_YEAR.period_dk = CONTROL_DATE.PREVIOUS_YEAR_DK
AND FACT_PREV_YEAR.MUTUAL_FUND_DK = DIM_MF.MUTUAL_FUND_DK
GROUP BY CURRENT_MONTH_VALUE, PREVIOUS_MONTH_VALUE, PREVIOUS_YEAR,CURRENT_YEAR,Team_Name , Salesperson_Name,col_order ) AS QUERY
GROUP BY CURRENT_MONTH_VALUE, PREVIOUS_MONTH_VALUE, PREVIOUS_YEAR,CURRENT_YEAR,Team_Name , Salesperson_Name,col_order
order by col_order) as query1;


Thanks in advance.

Venkatesh
Jul 5 '06 #1
1 2090
Can anybody tell me the error even i am getting the same kind of error...
Jul 5 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Breck Carter | last post by:
Why do I get SQL0104N in UDB 8.1 for Windows Command Center - Interactive, when I copy-paste-and-execute this function from the docs? FWIW I have % defined as the statement terminator, but...
1
by: Najm Hashmi | last post by:
Hi all , I am trying to create a store procedure and I get the following error: SQL0104N An unexpected token "END-OF-STATEMENT" was found following "END". Expected tokens may include: "JOIN...
2
by: Mark McNary via DBMonster.com | last post by:
I have a developer getting a SQL0104N on an insert statement. He is inserting a list of values into a table and instead of putting 'NULL' into the statement, the program just puts a placeholder...
2
by: Pradeep | last post by:
DB2ers, In my setup, DB2 server is installed on a Windows box "test16" and "SAMPLE" database has been loaded. Now, on a clean Windows machine (test15), I installed DB2 client...
0
by: vaibhavsumant | last post by:
<project name="DBCreate" default="usage" basedir="."> <property name="user" value="db2admin"/> <property name="passwd" value="db2admin"/> <property name="dbprefix" value=""/> <property...
0
by: ALLYWEIR | last post by:
Hi, I am trying to create a partitoned table using the following:- CREATE TABLE ORDERS(ID INT, SHIPDATE DATE) PARTITION BY RANGE(SHIPDATE) ( STARTING '1/1/2006' ENDING...
0
by: vrama11 | last post by:
Hi, I am using DB2 V9.1.300.257 on Windows. When I try to get the visual explain plan for a query from the command editor, it gives the following error: SQL0104N An unexpected token "WITH...
4
by: Justin | last post by:
Excuted the statement through a SSH connection: db2 import from <filename.ixfof ixf messages /database/stage/ acct_news_asc.txt insert into userid.acct_news_asc And it worked fine. Ran the...
1
by: Justin | last post by:
We had a load that failed. Now we have a pending load. When executing load terminate, we receive the following error: db2 load terminate SQL0104N An unexpected token "terminate" was found...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.