Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
lotussutol
Frequent Visitor

DataSource.Error: Oracle: ORA-00911: invalid character

I am looking for help on why the following SQL does not work in Power BI.

 

The SQL I have works fine when I test it in TOAD but when I try it in Power BI I get the following error.

DataSource.Error: Oracle: ORA-00911: invalid character
Details:
DataSourceKind=Oracle
DataSourcePath=d7ip_adg
Message=ORA-00911: invalid character
ErrorCode=-2147467259

 

Here is the SQL.

 

WITHq as ( 
    select        table1.name as label,        count(table1.id) as count_id,        
        row_number() over (order by count(table1.id) desc) as rn    
    from table1   
    where table1.name like 'D%'  
    group by table1.name)
select
    case
        when rn <= 9
        then label
        else 'Other'
    end label,    sum(count_id) count_idfrom qgroup by
    case
        when rn <= 9
        then label
        else 'Other'
    end;

IF I strip out the last part and run it like this it will return data but not group it up like I need.

 

select        table1.name as label,        count(table1.id) as count_id,        
        row_number() over (order by count(table1.id) desc) as rn    
    from table1   
    where table1.name like 'D%'  
    group by table1.name

 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@lotussutol,

Please remove semicolon at the end of your command. I can import data to Power BI Desktop successfully when I execute this statement :

WITH q as ( 
    select        table1.name as label,        count(table1.id) as count_id,        
        row_number() over (order by count(table1.id) desc) as rn    
    from table1   
    where table1.name like 'D%'  
    group by table1.name)
select
    case
        when rn <= 9
        then label
        else 'Other'
    end label,    sum(count_id) count_id from q group by
    case
        when rn <= 9
        then label
        else 'Other'
    end

 


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@lotussutol,

Please remove semicolon at the end of your command. I can import data to Power BI Desktop successfully when I execute this statement :

WITH q as ( 
    select        table1.name as label,        count(table1.id) as count_id,        
        row_number() over (order by count(table1.id) desc) as rn    
    from table1   
    where table1.name like 'D%'  
    group by table1.name)
select
    case
        when rn <= 9
        then label
        else 'Other'
    end label,    sum(count_id) count_id from q group by
    case
        when rn <= 9
        then label
        else 'Other'
    end

 


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, that worked!

lotussutol
Frequent Visitor

ugh...the formating made the SQL look really ugly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.