user1205746
user1205746

Reputation: 3364

Importing data into power pivot table using SQL query

I am running into a road block that kinda puzzled me and hopefully you guys could give me a hint. I am trying to import data from a view in an oracle database. Very simple selection statement like this:

select n."A", n"B", p."C", p."D", p2."F" from N n, P p, Q p2 where n."A"=p."A" and n."E"=p2."E"

Where N is a view, P, Q are tables in the Oracle database. The above is a simple version of the actual SQL statement as the later actually has a lot more fields than the statement above but the nature of the issue is identical. I ran the statement from SQL Developer and it ran perfectly with no error. From power pivot, I can see the view and the tables when I chose "Select from a list of tables and views to choose the data to import". However, if I selected "Write a query that will specify the data to import" and entered the statement above in the SQL Statement box, I got the error "ORA-00942: table or view does not exist". I am pretty sure if I created another view from SQL developer that is defined by the statement above and selected the 1st option ("Select from a list of tables and views to choose the data to import"), I would encounter no error but I prefer using the second option. Is it possible to do that? If it is possible, then I might have done something incorrectly. I would appreciate it if someone could point it out. Thanks!

Upvotes: 0

Views: 1179

Answers (1)

Bill Anton
Bill Anton

Reputation: 2970

Looks like you have a typo...

SELECT n."a", 
       n"B", 
       p."c", 
       p."d", 
       p2."f" 
FROM   n n, 
       p p, 
       q p2 
WHERE  n."a" = p."a" 
       AND n."e" = p2."e"

should be...

SELECT n."a", 
       n."B",
       p."c", 
       p."d", 
       p2."f" 
FROM   n n, 
       p p, 
       q p2 
WHERE  n."a" = p."a" 
       AND n."e" = p2."e"

notice the difference in line 2 from each code block... n"B" vs n."B"

Upvotes: 1

Related Questions