AntDB-Oracle Compatibility Developer's Manual P0
Published: 2023-08-28 06:48:03

AntDB-Oracle Compatibility Reference Manual

**Documentation Conventions**

| Object| Content
|----------|----------
| The system account for running the database| The text uses antdb as the system account for running the database. 
| Database administrator name| The text uses antdb as the database administrator name.
| Example Environment| Except for the installation and uninstallation related sections, all the examples in the text use the Linux environment for sample operations.

1. This document introduces the new features. 

2. For more details about PostgreSQL's original features, please refer to the PostgreSQL11 Chinese Documentation.chm.

3. Please refer to the official Oracle website for more details about the compatible oracle syntax features.

# Get Started

## **Basic Knowledge**

### **Introduction to AntDB**

This guide describes the Oracle-compatible features in AntDB (hereafter referred to as AntDB). The feature means that an application running in the Oracle environment can be made to run in the AntDB environment with minimal (or in some cases no) changes to the application code. 

AntDB includes a number of features that allow developers to develop PostgreSQL or Oracle-compatible database applications. This guide is only for those features that are compatible with Oracle. To learn all the features of AntDB, please refer to the AntDB documentation set.

When developing Oracle-compatible applications in AntDB, you need to pay special attention to the features you need to use when designing your application. For example, developing an Oracle-compatible application means making the following choices.

Use Oracle-compatible data types to define the database tables used by the application.

- The application has to use Oracle-compatible SQL statements.

- Use Oracle-compatible systems and built-in functions in the SQL statements and program logic.

- Use Oracle-compatible procedure language to create server-side program logic, such as stored procedures, functions.

- Use system catalog views compatible with Oracle data dictionary.

All of these features are available in the standalone version of AntDB.

Each of these features is explained in detail in the rest of this guide.

### **Access the database**

You can access the database using the following methods.

1. run the AntDB interactive command line program psql, which allows you to enter, edit and execute SQL commands interactively.

2. Use one of our existing graphical front-end tools, such as pgAdmin or Office Suite with ODBC or JDBC support, to manage the database.

3. Write a client application to access the database using some language interface or driver such as libpq, JDBC, ODBC, etc.

**Example**

The following uses the psql command to connect to the postgres database as the antDB user. After connecting set the syntax of the current session to ORACLE and then execute the SQL statement table procedure.

```
[antdb@localhost ~]$ psql -U antdb -d postgres  -p 40009 
psql (12.3)
Type "help" for help.

postgres=# set grammar to oracle;
SET
postgres=# select now() from dual;
               NOW()
-----------------------------------
 2022-06-21 10:38:52.191666 +08:00
(1 row)

```