473,382 Members | 1,396 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,382 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 2089
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.