EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

Oracle Describe Table

Secondary Sidebar
Oracle Tutorial
  • Advanced
    • Timestamp to Date in Oracle
    • Oracle Golden Gate
    • Oracle Virtual Machine
    • Oracle Describe Table
    • Oracle Clauses
    • Oracle Having Clause
    • Oracle?Primavera
    • Oracle FOREIGN Key
    • PIVOT in Oracle
    • Oracle Alter Table
    • Oracle Queries
    • Oracle Views
    • Oracle Window Functions
    • Oracle String Functions
    • Oracle Date Functions
    • Oracle Analytic Functions
    • Oracle Aggregate Functions
    • Select in Oracle
    • INSERT in Oracle
    • DISTINCT in Oracle
    • Function in Oracle
    • Oracle GROUP_CONCAT
    • Oracle INSTR()
    • Oracle CONVERT
    • Oracle LENGTH()
    • Oracle EXISTS
    • Oracle REPLACE()
    • Oracle MERGE
    • Oracle LEAD()
    • Oracle EXTRACT()
    • Oracle LISTAGG()
    • Oracle SYS_CONTEXT()
    • Oracle COALESCE
    • Oracle NVL()
    • Oracle SYSDATE()
    • Oracle?Date Format
    • Oracle SYS_GUID()
    • Oracle WILDCARDS
    • Oracle Synonyms
    • Oracle Subquery
    • BETWEEN in Oracle
    • FETCH in Oracle
    • Oracle Index
    • Oracle Function-based Index
    • Oracle UNIQUE Index
    • Oracle Bitmap Index
    • Oracle Column
    • Oracle Triggers
    • Oracle Procedures
    • Sample Database for Oracle
    • Oracle LIKE Operator
    • ORDER BY in Oracle
    • Oracle ORDER BY DESC
    • GROUP BY in Oracle
    • Oracle GROUP BY HAVING
    • Oracle Aliases
    • Table in Oracle
    • Oracle Temporary Table
    • Oracle? Table Partition
    • Oracle rename table
    • Oracle CTE
    • Cursor in Oracle
    • Oracle LOCK TABLE
    • Oracle Tablespace
    • Oracle CARDINALITY
    • Oracle REGEXP
    • Oracle REGEXP_REPLACE
    • Oracle to_date
    • JSON in Oracle
    • Oracle COMMIT
    • Oracle GRANT
    • Oracle MD5
    • Oracle ROLLBACK
    • Oracle Users
    • Oracle TIMESTAMP
    • IF THEN ELSE in Oracle
    • Oracle While Loop
    • Oracle Clone Database
    • Oracle Backup Database
    • Oracle? XML
    • Oracle XMLAGG
    • Oracle XMLTABLE
    • Oracle Performance Tuning
    • Oracle B Tree Index
    • Oracle fusion
    • Oracle ebs
    • Oracle GRC
    • Oracle ERP
    • Oracle ASM
    • Oracle Cloud
    • Oracle HCM Cloud
    • Oracle Integration Cloud
    • Oracle Jinitiator
    • Oracle pathfinder
    • Oracle VirtualBox
    • Oracle Weblogic Server
    • Oracle decode
    • Oracle Exadata
    • Oracle ZFS
    • Oracle? utilities
    • JDBC Driver for Oracle
    • Oracle? DBA Versions
    • Oracle DBA Salary
  • Basic
    • Oracle Marketing Cloud
    • What is Oracle?
    • Career in Oracle
    • How to Install Oracle
    • Oracle Versions
    • What Is Oracle Database
    • Oracle Data Warehousing
    • Oracle Warehouse Builder
    • Career In Oracle Database Administrator
    • Career In Oracle DBA
    • What is Oracle RAC
    • Oracle DBA
    • Oracle? Vanderbilt
    • What is RMAN Oracle
    • Oracle Database Administration
    • Oracle Operators
    • Oracle Constraints
    • Oracle number
    • Oracle Data Types
    • Oracle UNIQUE Constraint
    • Oracle Check Constraint
  • Joins
    • Joins in Oracle
    • Inner Join in Oracle
    • Oracle Cross Join
    • Left Join in Oracle
    • OUTER Join in Oracle
    • Oracle Full Outer Join
    • Natural Join in Oracle
    • Oracle Self Join
    • Oracle hash join
    • Oracle? Update with Join
  • Oracle SET Operators
    • UNION in Oracle
    • Oracle UNION ALL
    • INTERSECT in Oracle
    • MINUS in Oracle
  • Interview Questions
    • Oracle Interview Questions
    • Oracle Apps Interview Questions
    • Oracle Apps Technical Interview Questions
    • Oracle Database Interview Questions
    • Oracle Forms Interview Questions
    • Oracle PL/SQL Interview Questions
    • Oracle RAC Interview Questions
    • Oracle SOA Interview Questions

Related Courses

Oracle Course Training

Oracle DBA Certification Course

MongoDB Certification Training

Home Data Science Data Science Tutorials Oracle Tutorial Oracle Describe Table

Oracle Describe Table

Definition of Oracle Describe Table

DESCRIBE function in Oracle database can be defined as the name suggest is used to describe something which in this case will be to describe the structure of the oracle database objects like a table (list the column specifications of the table), stored procedures, stored functions, the stored package in the database (specifications of the procedure or functions), view or synonym, it can also be written as DESC (both are same) and the function is case sensitive.

Syntax:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

In this section, we are going to discuss the syntax of the DESCRIBE in the Oracle database. The syntax for describe is very simple.

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (85,938 ratings)

DESC[RIBE] {schema_name.object_name};

Parameters

  • schema_name: It refers to the schema where the object is present.
  • object_name: It refers to the name of the database objects which can be a table, procedure views, functions, etc.

How to Describe Table in Oracle?

As we had discussed in the definition section of this article that the DESCRIBE or DESC function basically it is used to describe the structure of the data objects. So suppose we have a table in a particular schema in a database and we want to insert a record in that particular table. The role of DESCRIBE function comes here because it allows us to know the column specifications of the table and whether it allows null values or not. So, when we execute the DESC function then it returns the column names along with the data types of the columns and their size. This helps the user to get to know the structure of the table and based on that the user can insert appropriate data into the table.

Examples of Oracle Describe Table

In the earlier sections, we got to understand the definition, syntax, and working of the DESCRIBE function. Now, in this section, we are going to look at a few examples of the describe function to have a better understanding.

1. Describe Function to Describe a Table

In this example, we are going to use the Oracle database to check how the function describes the table. For that, we will create a table with a few columns and then we will use the describe function to describe the table. Let us prepare a CREATE statement to create a table.

Query:

CREATE table employee(employee_id varchar2(25) PRIMARY KEY,
employee_name varchar2(100), city varchar2(20), salary number(5));

In the above query, we are creating the table employee with the employee_id as the primary key and three more columns.

Let us now use the DESCRIBE command to know the structure of the table.

Query:

DESCRIBE employee;

Let us now execute the query in SQL developer and check the result.

Oracle Describe Table-1.1

As we can see in the screenshot the output displays the column names, whether the values in the columns can be NULL or NOT NULL, and the data type along with the size of the column. The first column is NOT NULL since we had added a PRIMARY KEY constraint to the column while creating the table.

2. Describe Function to Describe a Procedure

In this example, we are going to use the Oracle database to check how the DESCRIBE function describes a stored procedure. For that, we will create a procedure with two arguments, and then we will use the describe function to describe the procedure. Let us create a procedure.

Query:

CREATE OR REPLACE PROCEDURE print_sum(
first_number NUMBER, second_number NUMBER
)
IS
r_sum number:=0;
BEGIN
r_sum := first_number + second_number;
dbms_output.put_line( r_sum );

Exception:

WHEN OTHERS THEN
dbms_output.put_line( SQLERRM );
END;

In this procedure, we are calculating the sum of two values and we are using the two arguments as inputs to the procedure.

Let us now execute the above query in SQL developer and create the procedure. Once we have created the procedure then now we will use the DESCRIBE function to check the structure of the procedure.

Query:

DESCRIBE print_sum;

Let us now execute the query in SQL developer and check the result.

Oracle Describe Table-1.2

As we can see in the above screenshot the query returns the name of the arguments, the data type of the arguments, and also whether the arguments were IN, OUT, or DEFAULT.

3. Describe Function to Describe a Package

In this example, we are going to use the Oracle database to check how the DESCRIBE function describes a stored package. For that, we will create a package with two procedures, and then we will use the describe function to describe the package. Let us create the package.

Query:

CREATE PACKAGE pck1 AS
PROCEDURE print_sum(first_number NUMBER, second_number NUMBER);
PROCEDURE print_diff(first_number NUMBER, second_number NUMBER);
END pck1;

In this query, we are creating a package with two procedures and each procedure having two arguments. Let us now execute the query and create a package. After we have created the package let us now use the DESCRIBE function to get the structure of the package.

Query:

DESCRIBE pck1;

Let us execute the query in SQL developer and check the result.

Oracle Describe Table-1.3

As we can see in the above screenshot the query returns the structure of each procedure present inside the package

4. Describe Function to Describe an Object

In this example, we are going to use the Oracle database to check how DESCRIBE function describes an object.

Query:

CREATE TYPE EMPLOYEE_OBJ AS OBJECT
(EMPLOYEE_NAME VARCHAR2(30),
SALARY NUMBER(7,2)
);

In this query, we are creating an object with two columns. Let us now execute the above query in SQL developer and create the object. Once we have created the object then now we will use the DESCRIBE function to check the structure of the object.

Query:

DESCRIBE EMPLOYEE_OBJ;

Let us execute the query in SQL developer and check the result.

Oracle Describe Table-1.4

As we can see in the screenshot of the output, the name of the column along with their data type and size is displayed.

Recommended Articles

This is a guide to Oracle Describe Table. Here we also discuss the definition and how to describe the table in oracle? along with different examples and its code implementation. You may also have a look at the following articles to learn more –

  1. Oracle SYSDATE()
  2. Oracle COALESCE
  3. PIVOT in Oracle
  4. Oracle CTE
Popular Course in this category
Oracle Training (14 Courses, 8+ Projects)
  14 Online Courses |  8 Hands-on Projects |  120+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Oracle DBA Database Management System Training (2 Courses)4.9
All in One Financial Analyst Bundle- 250+ Courses, 40+ Projects4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Oracle Training (14 Courses, 8+ Projects) Learn More