简体   繁体   中英

Unable to create directory in oracle 12c

I am using Oracle 12.2 .I wish to import data pump files. To do that, I wish to create a directory, containing the files and then import. I use the following command to create directory

CREATE DIRECTORY dpump_dir1 AS  ‘D:\dumpdir’;

I am getting the error as

SQL Error: ORA-00911: invalid character 00911. 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. Could anybody tell me what is going wrong?

The quotes being used in the code you provided are not simple straight single quotes; it's slightly easier to see when formatted as code:

CREATE DIRECTORY dpump_dir1 AS  ‘D:\dumpdir’;

You can also use your text editor or dump the string to see which chraacters it contains:

select dump(q'[CREATE DIRECTORY dpump_dir1 AS  ‘D:\dumpdir’;]', 1016) from dual;

DUMP(Q'[CREATEDIRECTORYDPUMP_DIR1AS‘D:\DUMPDIR’;]',1016)                                                                                                                               
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Typ=96 Len=49 CharacterSet=AL32UTF8: 43,52,45,41,54,45,20,44,49,52,45,43,54,4f,52,59,20,64,70,75,6d,70,5f,64,69,72,31,20,41,53,20,20,e2,80,98,44,3a,5c,64,75,6d,70,64,69,72,e2,80,99,3b

You can see that it's reported at 49 bytes despite being 45 characters long, indicating you have multibyte characters. Before the final semicolon , which is shown as 3b , you have the sequence e2,80,99 which represents the ' right single quotation mark , and a bit earlier you have the sequence e2,80,98 which represents the ' left single quotation mark .

If you use plain quotes it should work:

CREATE DIRECTORY dpump_dir1 AS  'D:\dumpdir';

Presumably you copied and pasted the text from an editor which helpfully substituted curly quotes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM