|
-
Jul 17th, 2009, 06:23 AM
#1
Thread Starter
New Member
No data when query run using Excel from Oracle
Hi,
I would like to extract data from Oracle to Excel. I have created and tested the connection using ADO. When I run the query in Oracle SQL Developer client, it runs fine. However the same query run in Excel, does not provide any data. Here is the query:
Code:
select decode(b.location,'Bangkok','Thailand','Beijing','China','China WSBB','China','Colombo','Sri Lanka','Colombo','Sri Lanka', 'DBIA', 'Singapore','DSI Tokyo','Japan','Guangzhou','China','Ho Chi Minh','Vietnam','Hong Kong','HONGKONG', 'Hong Kong LON','HONGKONG','Jakarta','Indonesia','Karachi','Pakistan','Kuala
Lumpur','Malaysia','London','Malaysia', 'Manila','Philippines','Mumbai','India','Seoul','South Korea','Shanghai','China','Singapore','Singapore', 'Singapore local','Singapore','Sydney','ANZ','Sydney GMF','ANZ','Taipei','Taiwan','Tokyo
Consolidated','Japan', 'Tokyo Sales','Japan',b.location), count(t.systemid)
from rms_owner.trade t, book b
where t.systemid > 209240000
and t.systemid < 209250000
and t.book in (
select name from book where location in ('Bangkok','Beijing','China
WSBB','Colombo','Colombo','DBIA','DSI Tokyo','Guangzhou',
'Ho Chi Minh','Hong Kong','Hong Kong LON','Jakarta','Karachi','Kuala
Lumpur','Manila','Mumbai','Seoul','Shanghai','Singapore',
'Singapore local','Sydney','Sydney GMF','Taipei','Tokyo Consolidated','Tokyo Sales')
AND status = 'Open' AND bookgroupYN = 'N'
)
and t.lastupdated between '01-JUN-2009' and '30-JUN-2009'
and t.datecreated between '01-JUN-2009' and '30-JUN-2009'
and t.tradetable not in ( 'FXCASHBALANCE','CASHBALANCE')
and t.action !='Roll'
and b.name = t.book
group by b.location
Why is there a problem?
-
Jul 17th, 2009, 08:52 AM
#2
Re: No data when query run using Excel from Oracle
Try giving your decoded field allias (perhaps location?):
Code:
SELECT
decode(b.location,
'Bangkok','Thailand',
'Beijing','China',
'China WSBB','China',
'Colombo','Sri Lanka',
'Colombo','Sri Lanka',
'DBIA', 'Singapore',
'DSI Tokyo','Japan',
'Guangzhou','China',
'Ho Chi Minh','Vietnam',
'Hong Kong','HONGKONG',
'Hong Kong LON','HONGKONG',
'Jakarta','Indonesia',
'Karachi','Pakistan',
'Kuala Lumpur','Malaysia',
'London','Malaysia',
'Manila','Philippines',
'Mumbai','India',
'Seoul','South Korea',
'Shanghai','China',
'Singapore','Singapore',
'Singapore local','Singapore',
'Sydney','ANZ',
'Sydney GMF','ANZ',
'Taipei','Taiwan',
'Tokyo Consolidated','Japan',
'Tokyo Sales','Japan',
b.location) location,
count(t.systemid)
FROM
rms_owner.trade t, book b
where
t.systemid > 209240000
and t.systemid < 209250000
and t.book in (select name
from book
where location in ('Bangkok','Beijing','China WSBB','Colombo','Colombo','DBIA','DSI Tokyo','Guangzhou',
'Ho Chi Minh','Hong Kong','Hong Kong LON','Jakarta','Karachi','Kuala Lumpur',
'Manila','Mumbai','Seoul','Shanghai','Singapore',
'Singapore local','Sydney','Sydney GMF','Taipei','Tokyo Consolidated','Tokyo Sales')
AND status = 'Open'
AND bookgroupYN = 'N'
)
and t.lastupdated between '01-JUN-2009' and '30-JUN-2009'
and t.datecreated between '01-JUN-2009' and '30-JUN-2009'
and t.tradetable not in ( 'FXCASHBALANCE','CASHBALANCE')
and t.action !='Roll'
and b.name = t.book
group by b.location
Also, why not defining a Country directly in the database so you wouldn't have to decode that many values?
-
Jul 19th, 2009, 09:01 PM
#3
Thread Starter
New Member
Re: No data when query run using Excel from Oracle
Hi,
I tried using alias. It did not work. I dont think the problem is in decode. When I tried running the query using * instead of decode, it still did not work in excel.
Regards.
-
Jul 20th, 2009, 01:34 PM
#4
Re: No data when query run using Excel from Oracle
 Originally Posted by aseem12321
Hi,
I tried using alias. It did not work. I dont think the problem is in decode. When I tried running the query using * instead of decode, it still did not work in excel.
Regards.
Are you able to fetch data from Oracle into your Excel spreadsheet?
Did you try with any other table?
Sometimes the issue lies elsewhere, like user permissions on the object, etc.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Jul 20th, 2009, 08:41 PM
#5
Thread Starter
New Member
Re: No data when query run using Excel from Oracle
Hi, I found the error. I was just using column name to fetch data where as when I tried using table.column, it worked. Thanks guys.
Cheers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|