AppendixB.Use of Uppercase Versus Lowercase in DB2


Appendix B. Use of Uppercase Versus Lowercase in DB2

Table B.1 identifies which kinds of commands, parameters, objects, and data are case-sensitive in DB2 UDB for Linux, UNIX, and Windows and gives examples.

Table B.1. Table B.1 Case-Sensitivity Requirements in DB2

Category

Description

Examples

DB2 system commands (including the db2 executable)

You can treat DB2 system commands like any other program or application launched from the operating system.

On Windows, the case does not matter.

On Linux and UNIX, the case does matter, and since all DB2 system commands are named in lowercase, you need to issue the commands in lowercase.

These work in Linux, UNIX, and Windows:

 db2 db2start db2ilist 

These only work in Windows:

 dB2 db2STARt DB2ILIST 

CLP commands

You can invoke CLP commands from the DB2 Command Line Processor, the DB2 Command Window (Windows only) and the Command Editor. These tools do not care about the case of the command.

These work in Linux, UNIX, and Windows:

 list applications LIST apPLicatIONs 

Or if working with the CLP in non-interactive mode:

 db2 list applications db2 LIST apPLicatIONs 

SQL statements

You can invoke SQL statements from within an application or tool like the CLP. DB2 tools do not care about the case of the SQL statement.

These work in Linux, UNIX, and Windows:

 select * from employee SELECT * frOM emPLOYee 

When you create database objects, you can specify the object name in any case. However, DB2 usually stores names in the DB2 catalog in uppercase unless you use double quotes enclosing the object name when you create the object.[a]

These work in Linux, UNIX, and Windows:

 create table Tab1 ... create table taB1 ... 

(TAB1 will be stored in the DB2 catalog tables)

 create table "taB1" 

(taB1 will be stored in the DB2 catalog tables)

DB2 registry variables

Case-insensitive on all platforms.

These work in Linux, UNIX, and Windows:

 db2options DB2optIOns 

DB2 configuration parameters

Case-insensitive on all platforms.

These work in Linux, UNIX, and Windows:

 INTRA_PARALLEL intra_PARAllel 

User data stored in the database

DB2 stores the data in your database exactly the way you inserted it.

In Linux, UNIX, and Windows, if you issue:

 insert into mytable (col2) values ('RAul') 

Then column col2 in table mytable will have the value RAul, just as it was inserted.

Database object names or any system data already stored in DB2 catalog tables

Typically any database object names or system-related data stored implicitly by DB2 itself is in uppercase. However, the object name can be in mixed case if it was created using double quotes.[a]

Keep this in mind when you refer to these objects in a query.

In Linux, UNIX, and Windows if you issue:

 create table t1 (col2 integer) 

t1 will be stored as T1 and col2 will be stored as COL2 in DB2 catalog tables.

If double quotes enclose the object:

 create table "t1" (col2 integer) 

t1 will be stored as t1 and col2 will be stored as COL2 in DB2 catalog tables.


[a] Using the CLP in Windows to create an object in mixed case by using double quotes will not work. Use the Command Editor instead.



Understanding DB2(R. Learning Visually with Examples)
Understanding DB2: Learning Visually with Examples (2nd Edition)
ISBN: 0131580183
EAN: 2147483647
Year: 2004
Pages: 313

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net