Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Introduction to the Teradata® RDBMS for UNIX® Version 2 Release 2.1 - NCR

NCR Introduction to the Teradata® RDBMS for UNIX® Version 2 Release 2.1 - NCR, 1998. - 315 p.
Download (direct link): inntroduktionteradata1998.pdf
Previous << 1 .. 35 36 37 38 39 40 < 41 > 42 43 44 45 46 47 .. 76 >> Next


• INSERT

• UPDATE

• DELETE

7-6

Introduction to the Teradata RDBMS for UNIX
Data Dictionary

Using the Data Dictionary

For example, suppose you needed to know some things about the Personnel database. You could query the DBC.DataBases view like this:

SELECT Databasename,

Creatorname,

Ownername,

Permspace FROM DBC.DataBases WHERE Databasename='Personnel' t

The report produced by this query looks like this.

Databasename Creatorname Ownername Permspace
Personnel Jones Jones 1,000,000

Introduction to the Teradata RDBMS for UNIX

7-7
Data Dictionary

For More Information

For More Information

For more information on the topics presented in this chapter, see the following Teradata RDBMS manuals.

IF you want to learn more about . . . THEN see this manual . . .
the Data Dictionary Teradata RDBMS for UNIX Data
Dictionary Reference
Teradata RDBMS for UNIX
Database Design and
Administration

7-8

Introduction to the Teradata RDBMS for UNIX
Application Development

Chapter 8

Application Development

Introduction to the Teradata RDBMS for UNIX
Application Development

Introduction to the Teradata RDBMS for UNIX
Application Development

About This Chapter

Introduction

Explicit SQL Development

Implicit SQL Development

About This Chapter

Teradata SQL is the only language the Teradata RDBMS understands. You can think of application development for the Teradata RDBMS as falling into one of two categories: explicit SQL or implicit SQL.

Under explicit SQL application development you have the following tools:

• Embedded SQL

• BTEQ

• Teradata and third party products that package and submit SQL

• CLI calls

• ODBC calls

Macros are also a means of submitting SQL queries to the Teradata RDBMS.

Under implicit SQL application development you have tools such as Teradata and third party products that permit various fourth generation languages and application generators to be translated into SQL.

This chapter describes the various facilities and tools used to develop applications for the Teradata RDBMS in these environments.

Introduction to the Teradata RDBMS for UNIX

8-1
Application Development

Writing Embedded SQL Applications

Introduction

What is Embedded SQL?

How Does an Application Program Use Embedded SQL?

Writing Embedded SQL Applications

This topic introduces writing applications using embedded SQL.

When you write applications using embedded SQL, you insert SQL statements into your native language application program.

Because third generation application development languages do not have facilities for dealing with results sets, embedded SQL contains extensions to executable SQL that permit declarations.

Embedded SQL declarations include:

• Code to encapsulate the SQL from the native application language

• Cursor definition and manipulation.

A cursor is a pointer device you use to read through a results table one record (row) at a time.

The client application languages that support embedded SQL are all compiled languages. SQL is not defined for any of them. For this reason, you must precompile your embedded SQL code to translate the SQL into native code before you can compile the source using a native compiler. This precompiler tool is called Preprocessor2.

The precompiler reads your application source code looking for the defined SQL code fragments.

After it isolates all the SQL code in the application, it interprets the intent of the code and translates it into CLI calls.

The precompiler then comments out all the SQL source.

The output of the precompiler is native language source code with CLI calls substituting for the SQL source.

You can then process this converted source code with the native language compiler.

8-2

Introduction to the Teradata RDBMS for UNIX
Supported Languages and Platforms

Application Development

Writing Embedded SQL Applications

Preprocessor2 supports the following application development languages on the specified platforms.

Application development language Platform
C • IBM mainframe clients
• UNIX clients
COBOL • IBM mainframe clients
• Some workstation clients
PL/I IBM mainframes

Introduction to the Teradata RDBMS for UNIX

8-3
Application Development

Using Macros as SQL Applications

Introduction

Creating a Macro

Using Macros as SQL Applications

Teradata macros are SQL statements that are stored on the server and executed there. The advantage is less channel traffic and easy execution of frequently used SQL operations. Macros are particularly useful for enforcing data integrity rules, for providing data security and improving performance.

You use the CREATE MACRO statement to create Teradata macros. The format of CREATE MACRO is similar to CREATE VIEW.

For example, suppose you wanted to define a macro for adding new employees to the Employee table and incrementing the EmpCount field in the Department table. The CREATE MACRO statement looks like this:
Previous << 1 .. 35 36 37 38 39 40 < 41 > 42 43 44 45 46 47 .. 76 >> Next