UTF-8 Unicode (with BOM), resulting in SQL script execution error

Source: Internet
Author: User

UTF-8 Unicode (with BOM), resulting in SQL script execution error
For the differences between BOM with and without BOM, let's take a look at the discussion above.
Link: What is the difference between BOM-free UTF-8 and BOM-free UTF-8?

During recent development, SQL Files written in windows always report errors when executed in linux.

At the beginning of the file, whether it is to use Chinese or English comments, or even remove the comments, will also report SP2-0734: unknown command beginning "? Declare... "-restofline ignored. Error.
The following is the initial part of the file.

 
 
  1. --create tablespace
  2. declare
  3. v_tbs_name varchar2(200):='hytpdtsmsshistorydb';
  4. begin
The following error is reported:
 
 
  1. SP2-0734: unknown command beginning "?--create ..." - rest of line ignored.


  2. PL/SQL procedure successfully completed.
I have not found a solution to this problem on the Internet, and the file encoding has been changed to UTF-8.
Finally, check the difference between BOM and no BOM. If you try to change it to no BOM, there will be no errors.

Check the file encoding. The difference between a normal file and an error file is: with BOM
 
 
  1. [oracle@localhost Oracle_proc]$ file *
  2. bill_query_proc.sql: UTF-8 Unicode C program text
  3. crt_tab_hytpdtsmsshistorydb.sql: UTF-8 Unicode(with BOM)text
You can modify the encoding type of a file in two ways:
1. Use VI to modify the file encoding type
: Set encoding = UTF-8
: Set nobom

2. Use ultraedit in windows and save it as a UTF-8-No BOM

After the modification is completed, both Chinese and English are used, or annotations are removed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.