0
votes

I wrote a code to find few items by a particular number but it keeps saying that is something is an "invalid character"."ORA-00911: invalid character

  1. 00000 - "invalid character" *Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual. *Action: Error at Line: 14 Column: 23"

My brain is blown,I am not sure where the problem exists.

Need Help. Thanks.

select
a.app_num,
a.crs_pol_num,
kl.score,
kl.risk_level_desc
from
application a,
kyc_new_risk_level kl
where
a.app_num = kl.app_num
and a.app_num = (select max(to_number(a1.app_num)) from 
application a1,
kyc_new_risk_level kl1 where kl1.app_num = a1.app_num and a1.crs_pol_num = a.crs_pol_num)
and a.crs_pol_num in (‘CG0147511’,
‘CG0133662’,
‘CG0138107’,
‘493186’,
‘CG0142230’,
‘CS0138382’,
‘CG0147509’,
‘CG0147545’,
‘921141048001’,
‘CG0347239’,
‘CG0142212’,
‘CG0147518’,
‘CG0134057’,
‘CG0143158’,
‘CG0147536’,
‘CG0244124’,
‘CG0134102’,
‘CG0241709’,
‘CG0147197’,
‘CG0137204’,
‘CG0347496’,
‘CG0147490’,
‘CG0143467’,
‘CG0135689’,
‘CG0146904’,
‘CS0132517’,
‘CG0145455’,
‘CG0147554’,
‘CG0133626’,
‘CG0147560’,
‘CG0135359’,
‘CG0133303’,
‘921165287001’,
‘CG0147546’,
‘CG0114581,
‘CG0122266’,
‘CG0236577’,
‘CG0345349’,
‘CG0132670’,
‘CG0147413’,
‘CG0241646’,
‘CG0143783’,
‘CG0245160’,
‘CG0124066’,
‘CG0124830’,
‘CG0145956’,
‘CG0232953’,
‘CG0144479’,
‘CG0147569’,
‘CG0147555’,
‘CG0244857’,
‘CG0147562’,
‘CG0347578’,
‘CG0346461’,
‘CS0133352’,
‘512097’,
‘CS0127026’,
‘CG0147583’,
‘CG0233314’,
‘CG0247096’,
‘CG0131282’,
‘CG0123462’,
‘CS0124502’,
‘CG0146034’,
‘CG0140236’,
‘CS0126420’,
‘CG0147557’,
‘CG0123182’,
‘CG0233300’,
‘CG0132782’,
‘CG0147501’,
‘CS0141693’,
‘CG0145237’,
‘CG0141763’,
‘CG0147591’,
‘CG0144107’,
‘CG0125208’,
‘CG0132306’);
1
Change the oriented quotes to regular quotes. For instance: 'CG0147511' instead of ‘CG0147511’vc 74
IT's treating the numeric values as column names or variables those can't start with numbers: thus the error. the type of quote used is the problem. Eliminate those with a # starting in the in clause and problem goes away right?xQbert

1 Answers

2
votes

SQL Developer is showing you the problem before you even run your query

enter image description here

That's not a quote, it's a smart quote. Which is nice for browsers and word processors - but not so much for the database engine.

If you click on that hint, it will replace it with a real single quote.

But with so many to fix, would be much faster, better to use search and replace.

But your cursor on the bad character, and hit Ctrl+R

enter image description here

And then hit 'replace all', then repeat for the closing smart quote.

But in case you missed all that, the error also back from the DB tells you where the issue is

enter image description here