Differences between Oracle and SQL Server in SQL statements

Source: Internet
Author: User

Both Oracle and SQL Server comply with SQL-92 standards: Compliance:

  1. In Oracle, the table name, field name, stored procedure name, and variable name cannot exceed 30 string lengths.
  2. The top syntax is not supported in Oracle. Use whererownum <n instead. However, you need to note that if there is a sorting operation before top, you need to first sort the operation and get it using rownum.
  3. The usage of optical standards in Oracle differs significantly from that in SQL Server, mainly in terms of loop control.
  4. In Oracle, if a column is of the date type, the default format is yyyy-mm-dd. If you use where coldate = '2017-06-08 17:14:57 ', an error occurs, '2017-06-08. If you need to accurately compare the time (hours, minutes, seconds), you can use the following methods: to_date ('2017-6-8 17:14:57 ', 'yyyy-mm-dd hh24: MI: SS '). Since Oracle and sqlserver have different methods to expand the SQL standard on datetime, the same SQL cannot be used.
  5. The timestamp (timestamp) in Oracle differs greatly from that in SQL Server. Timestamp in sqlserver is stored in the database in binary format. You can set this field type in dataset to base64binary. Timestamp in Oracle is stored in time format. Therefore, you cannot use the same dataset to load the timestamp of sqlserver and the timestamp of oracle.ProgramThis value is rarely used, so you can not retrieve this field.
  6. The timestamp in Oracle cannot be automatically filled when SQL Server imports data. You can set the default value of systimestamp to implement similar functions.
  7. Oracle does not have a Boolean field type. You can use intger or Char to replace the bit type in SQL Server.
  8. In Oracle, multiple null values are processed as "null" strings. That is to say, when an application inserts an empty string into the database, the actual database tries to insert a null string. If this field is of the notnull type, an error occurs. In this case, you can use another default value to replace the Null String. When importing data from sqlserver to Oracle, an empty string in the notnull column will cause the export operation to fail. In this case, you can manually modify the SQL script in the export wizard and set the null string to a special value.
  9. Not supported in Oracle,Select...Create a new table,Use the create table table name as select statement to create a new table.
  10. The '|' or Concat (col1, col2) function is used to connect strings in Oracle. '+' cannot be used '.
  11. The wildcard [], [^], does not seem to be supported by Oracle. 

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.