Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

What is Teradata Objects? A Tutorials & Guide

Teradata Objects

Below are the list of objects contains in Teradata database or User:

  • Tables–rows and columns of data
  • Views–predefined subsets of existing tables
  • Macros–predefined, stored SQL statements
  • Triggers–SQL statements associated with a table
  • Stored Procedures–program stored within Teradata
  • User-Defined Function–function (C program) to provide additional SQL functionality
  • Join and Hash Indexes –separate index structures stored as objects within a database
  • Permanent Journals–table used to store before and/or after images for recovery

Important Note:

  • Objects which require permanent spaces are:- Tables , Triggers, Stored Procedures, User-Defined Function, Join and Hash Indexes & Permanent Journals
  • Objects which not require permanent spaces are:- Macros & Views
  • Join and Hash Indexes and Permanent Journals – These aren’t directly accessed by users (these will be explained in details in another blog)
  • These objects are created, maintained, and deleted using SQL.
  • Object definitions are stored in the DD/D.

What is The Data Dictionary Directory (DD/D)

(It will be explained in details in another topic)

All Objects definitions are stored in the DD/D.

The DD/D

  • is an integrated set of system tables
  • contains definitions of and information about all objects in the system
  • is entirely maintained by the Teradata Database
  • is “data about the data” or “metadata”
  • is distributed across all AMPs like all tables
  • is normally accessed via Teradata supplied views

Examples of DD/D views:

DBC.TablesV- information about objects (e.g., tables) in a database/user
DBC.UsersV- information about all users
DBC.AllRightsV- information about access rights
DBC.AllSpaceV- information about space utilization

Teradata Objects in Details:

Below are the four important Teradata objects explained in details:

1. Tables

It contains rows and columns

To create and store the table structure definition in the DD/D, you can execute the CREATE TABLE DDL statement

examples:

Above definition is stored in DD/D

2. Views

Views are pre-defined filters of existing tables consisting of specified columns and/or rows from the table(s).

A single table view:

  • is a subset of an underlying table
  • allows users to read and update a subset of the underlying table
  • has no data of its own

A multi-table:

A multi-table view allows users to access data from multiple tables as if it were in a single table.
Multi-table views (i.e., join views) are used for reading only, not updating.

3. Macros

A MACRO is a predefined set of SQL statements which is logically stored in a database.

Macros have many features and benefits:

  • Simplify end-user access
  • Control which operations may be performed by users
  • May accept user-provided parameter values
  • Are stored in the Teradata Database, thus available to all clients
  • Reduces query size
  • Are optimized at execution time
  • May contain multiple SQL statements

To create a macro:

CREATE MACRO Customer_ListAS (SELECT CustNameFROM Customer;);

To execute a macro:

EXEC Customer_List;

To replace a macro:

REPLACE MACRO Customer_ListAS(SELECT CustNumber, CustNameFROM Customer;);

4. Stored Procedures

A stored procedure contains a set of SQL statements and procedural statements.

They consist of a set of control and condition handling comments that make SQL a computationally complete programming language.

The definition of the stored procedure is stored in the database, and the parameters are stored in data dictionary tables.

Teradata procedure support most of the operations, for example

  • Insert / Update / Merge / Delete
  • Drop / Truncate / Create Table/View
  • Collect Statistics
  • Procedure Calls
  • Iteration[For/While loop]
  • Cursors
  • Variable manipulation
  • Conditions [If/ELSE]

Teradata procedures can be of two types:

  • General Procedure: Procedure that performs some action in the background
  • Dynamic procedure: Procedures that returns result set/query result

Advantages of using Stored Procedures:

  • Stored procedures reduce the network load between the client and the server.
  • It provides better security since the data is accessed through stored procedures instead of accessing them directly.
  • It gives better maintenance since the business logic is tested and stored in the server.

Syntax

To Create a PROCEDURE .

CREATE PROCEDURE <procedurename> ( [parameter 1 data type, parameter 2 data type..] )   

BEGIN   

   <SQL or SPL statements>;   

END;  

Examples:

Consider the following Salary Table of the employees.

CompanyIDIncomeTaxpayTotalpay
20200140,0002,00038,000
20200280,0003,00077,000
20200385,0005,00080,000
20200490,0002,00088,000

The following example creates a stored procedure named Insert Salary to accept the values and insert them into the Salary Table.

CREATE PROCEDURE InsertSalary   

(   

   IN in_CompanyID INTEGER,   

   IN in_Income INTEGER,   

   IN in_Taxpay INTEGER,   

   IN in_Totalpay INTEGER   

)   

BEGIN   

   INSERT INTO Salary   

(   

      CompanyID,   

      Income,   

      Taxpay,   

      Totalpay   

 )   

   VALUES   

(   

      :in_CompanyID,   

      :in_Income,   ,   

      :in_Taxpay,   

      :in_Totalpay   

  );  

   

END;  

To Execute Stored Procedures:

CALL <procedure name> [(parameter values)];  

To Compiling Procedure:

.COMPILE FILE [procedure_file];

To Get Procedure Code:

SHOW PROCEDURE [database_name.procedurename];

To Drop Procedure:

DROP PROCEDURE [database_name.procedurename];


Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
MotoShare.in is your go-to platform for adventure and exploration. Rent premium bikes for epic journeys or simple scooters for your daily errands—all with the MotoShare.in advantage of affordability and ease.

Related Posts

Comprehensive Tutorial on Cloud Storage

📖 1. What is Cloud Storage? Cloud Storage refers to the service model where data is stored, managed, and accessed remotely over the internet instead of being…

Read More

What is DataStax Astra?

DataStax Astra DB simplifies cloud-native application development, and reduces time to install, deploy and scale from weeks to minutes. Astra DB eliminates operational overhead, the biggest obstacle…

Read More

What is ClickHouse?

Clickhouse is an open-source columnar-oriented Database Management System (DBMS) used for online analytical processing (OLAP) created by Yandex. Currently, it powers the second largest web analytics platform,…

Read More

What is Cassandra?

Apache Cassandra is an open source non-relational, or NoSQL, a database that enables continuous availability, tremendous scale, and data distribution across multiple data centers and cloud availability…

Read More

What is BigQuery?

Nowadays, the age of tech big Data information is continuously increasing in volume and variety. This is the information that companies would like to quickly explore to…

Read More

What is Azure SQL?

Azure SQL is Microsoft’s cloud database service. Based on SQL Server database technology and built on Microsoft’s Windows Azure cloud computing platform, SQL Azure enables organizations to…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x