Getting Invalid character while executing the query(error code 00911)

srikotesh
srikotesh used Ask the Experts™
on
Hi Experts,

The below query is getting 00911 ERROR INVALID CHARACTER
What will be the wrong in the below query

SELECT DISTINCT NVL ((SELECT ml_curcurrmajor
                         FROM curr_ref curr_ref
                         WHERE curr_ref.ml_curcurrcode = dv_curr_ref.curcurrcode
                           AND curr_ref.ml_curlanguage = NVL ('en', 'en')),
                         dv_curr_ref.curcurrmajor) AS currencyname,dv_curr_ref.curcurrcode AS currid
   FROM dv_curr_ref dv_curr_ref where dv_curr_ref.DELETEFLAG='N';

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Syntax looks good to me but I cannot run it since I don't have your tables.
My guess is you are getting that error when running the SQL inside some other product.  If so, remove the ending ';' and try again.

That said:  Why are you creating a table alias that is the same as the table name?

... FROM curr_ref curr_ref ...

It isn't incorrect but isn't necessary.

This doesn't do anything:  NVL ('en', 'en')

I also don't like the inline select.  I'm thinking a simple join should work.

Author

Commented:
Hi,

I Have removed ; at the end of the query still facing the issue
removed alias names
this input i gave it as  -->AND curr_ref.ml_curlanguage = 'en'

still no results
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
>>still no results

No results or still getting the invalid character error?

Can you explain how you are executing that query? Can you use sqlplus or SQL Developer?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
I am using sql developer
still getting the same error invalid character
Most Valuable Expert 2012
Distinguished Expert 2018
Commented:
Verify what you are running is what you posted.  Make sure the single quotes are actually single quotes and not smart quotes.

I dummied up some tables and it runs for me:
SQL> create table curr_ref(ml_curcurrmajor char(1), ml_curcurrcode char(1), ml_curlanguage char(1));

Table created.

SQL> create table dv_curr_ref( curcurrcode char(1), curcurrmajor char(1), DELETEFLAG char(1));

Table created.

SQL> SELECT DISTINCT NVL ((SELECT ml_curcurrmajor
  2                           FROM curr_ref
  3                           WHERE curr_ref.ml_curcurrcode = dv_curr_ref.curcurrcode
  4                             AND curr_ref.ml_curlanguage = 'en' ),
  5                           dv_curr_ref.curcurrmajor) AS currencyname,dv_curr_ref.curcurrcode AS currid
  6     FROM dv_curr_ref where dv_curr_ref.DELETEFLAG='N';

no rows selected

Open in new window

Author

Commented:
now i am able to execute the query.
looks like space issue.
thanks

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial