How do I Check Oracle SQL Syntax?

Save

The Oracle relational database management system includes a powerful query engine that allows database users and administrators to retrieve, update and delete data. The language used to perform these queries is referred to as the structured query language, or SQL. Each version of SQL is defined by the American National Standards Institute, and Oracle 9i and above supports the 1999 standard. SQL syntax is divided into three query types: data definition language, or DDL; data manipulation language, or DML; and data control language. DML is the most common set of commands with "select," "insert," "update" and "delete." SQL commands are entered through a user interface that connects to the database and executes validated requests.

Things You'll Need

  • Query tool (Oracle SQLPlus, Toad, SQLNavigator, Access)
  • User schema

Basic Syntax

  • Log in to Oracle using SQLPlus or another tool.

  • Enter "Select * from dual;". Oracle follows standard SQL syntax of command object and source. Dual is a default object.

  • Read error: "ORA-00942: table or view does not exist". Oracle first does a syntax check that the statement is properly formed, followed by a semantic check that the object requested exists and the user has permissions to access it.

  • Enter "Select * from dual;". Oracle successfully processes the request and returns a result.

Check Parsing Path

  • Enter "set autotrace on" to turn on the SQLPlus trace environment setting.

  • Enter "Select from dept where deptno = 10;" or "Select from dual". Either command will give a result followed by a breakdown of the execution plan by the DBMS to access each object such as a table or index. Costs for the database to look up information and estimated row counts are also provided.

  • Enter "LIST". SQLPlus will display the last command entered to review for syntax.

References

  • Photo Credit Kutay Tanir/Photodisc/Getty Images
Promoted By Zergnet

Comments

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!