ALTER SESSION SET NLS_TERRITORY=ITALY throws ORA-00911

7.6k views Asked by At

If I try to execute the statement ALTER SESSION SET NLS_TERRITORY=ITALY in SQL Developer, I get no errors. But if I run it through a Win Forms application of mine, connecting through the System.Data.OracleClient provider, I get the "ORA-0911: invalid character" error. Why? My version of Oracle is 10.2.0.1.0

2

There are 2 answers

0
GWu On

Try to wrap it in execute immediate:

execute immediate 'ALTER SESSION SET NLS_TERRITORY=ITALY';
0
Piddu On

Solved it. I was executing

ALTER SESSION SET NLS_TERRITORY=ITALY;
pl/sql block: DECLARE ... BEGIN ... END;
/

I removed the semicolon and replaced it with

ALTER SESSION SET NLS_TERRITORY=ITALY
/
pl/sql block: DECLARE ... BEGIN ... END;
/

and it works now