1. Trang chủ
  2. » Công Nghệ Thông Tin

Oracle SQL Plus The Definitive Guide- P22 pptx

10 251 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Локальный диск

    • cover

    • page_iii

    • page_iv

    • page_v

    • page_vii

    • page_viii

    • page_ix

    • page_xi

    • page_xii

    • page_xiii

    • page_xiv

    • page_xv

    • page_xvi

    • page_xvii

    • page_xviii

    • page_xix

    • page_xx

    • page_xxi

    • page_1

    • page_2

    • page_3

    • page_4

    • page_5

    • page_6

    • page_7

    • page_8

    • page_9

    • page_10

    • page_11

    • page_12

    • page_13

    • page_14

    • page_15

    • page_16

    • page_17

    • page_18

    • page_19

    • page_20

    • page_21

    • page_22

    • page_23

    • page_24

    • page_25

    • page_26

    • page_27

    • page_28

    • page_29

    • page_30

    • page_31

    • page_32

    • page_33

    • page_34

    • page_35

    • page_36

    • page_37

    • page_38

    • page_39

    • page_40

    • page_41

    • page_42

    • page_43

    • page_44

    • page_45

    • page_46

    • page_47

    • page_48

    • page_49

    • page_50

    • page_51

    • page_52

    • page_53

    • page_54

    • page_55

    • page_56

    • page_57

    • page_58

    • page_59

    • page_60

    • page_61

    • page_62

    • page_63

    • page_64

    • page_65

    • page_66

    • page_67

    • page_68

    • page_69

    • page_70

    • page_71

    • page_72

    • page_73

    • page_74

    • page_75

    • page_76

    • page_77

    • page_78

    • page_79

    • page_80

    • page_81

    • page_82

    • page_83

    • page_84

    • page_85

    • page_86

    • page_87

    • page_88

    • page_89

    • page_90

    • page_91

    • page_92

    • page_93

    • page_94

    • page_95

    • page_96

    • page_97

    • page_98

    • page_99

    • page_100

    • page_101

    • page_102

    • page_103

    • page_104

    • page_105

    • page_106

    • page_107

    • page_108

    • page_109

    • page_110

    • page_111

    • page_112

    • page_113

    • page_114

    • page_115

    • page_116

    • page_117

    • page_118

    • page_119

    • page_120

    • page_121

    • page_122

    • page_123

    • page_124

    • page_125

    • page_126

    • page_127

    • page_128

    • page_129

    • page_130

    • page_131

    • page_132

    • page_133

    • page_134

    • page_135

    • page_136

    • page_137

    • page_138

    • page_139

    • page_140

    • page_141

    • page_142

    • page_143

    • page_144

    • page_145

    • page_146

    • page_147

    • page_148

    • page_149

    • page_150

    • page_151

    • page_152

    • page_153

    • page_154

    • page_155

    • page_156

    • page_157

    • page_158

    • page_159

    • page_160

    • page_161

    • page_162

    • page_163

    • page_164

    • page_165

    • page_166

    • page_167

    • page_168

    • page_169

    • page_170

    • page_171

    • page_172

    • page_173

    • page_174

    • page_175

    • page_176

    • page_177

    • page_178

    • page_179

    • page_180

    • page_181

    • page_182

    • page_183

    • page_184

    • page_185

    • page_186

    • page_187

    • page_188

    • page_189

    • page_190

    • page_191

    • page_192

    • page_193

    • page_194

    • page_195

    • page_196

    • page_197

    • page_198

    • page_199

    • page_200

    • page_201

    • page_202

    • page_203

    • page_204

    • page_205

    • page_206

    • page_207

    • page_208

    • page_209

    • page_210

    • page_211

    • page_212

    • page_213

    • page_214

    • page_215

    • page_216

    • page_217

    • page_218

    • page_219

    • page_220

    • page_221

    • page_222

    • page_223

    • page_224

    • page_225

    • page_226

    • page_227

    • page_228

    • page_229

    • page_230

    • page_231

    • page_232

    • page_233

    • page_234

    • page_235

    • page_236

    • page_237

    • page_238

    • page_239

    • page_240

    • page_241

    • page_242

    • page_243

    • page_244

    • page_245

    • page_246

    • page_247

    • page_248

    • page_249

    • page_250

    • page_251

    • page_252

    • page_253

    • page_254

    • page_255

    • page_256

    • page_257

    • page_258

    • page_259

    • page_260

    • page_261

    • page_262

    • page_263

    • page_264

    • page_265

    • page_266

    • page_267

    • page_268

    • page_269

    • page_270

    • page_271

    • page_272

    • page_273

    • page_274

    • page_275

    • page_276

    • page_277

    • page_278

    • page_279

    • page_280

    • page_281

    • page_282

    • page_283

    • page_284

    • page_285

    • page_286

    • page_287

    • page_288

    • page_289

    • page_290

    • page_291

    • page_292

    • page_293

    • page_294

    • page_295

    • page_296

    • page_297

    • page_298

    • page_299

    • page_300

    • page_301

    • page_302

    • page_303

    • page_304

    • page_305

    • page_306

    • page_307

    • page_308

    • page_309

    • page_310

    • page_311

    • page_312

    • page_313

    • page_314

    • page_315

    • page_316

    • page_317

    • page_318

    • page_319

    • page_320

    • page_321

    • page_322

    • page_323

    • page_324

    • page_325

    • page_326

    • page_327

    • page_328

    • page_329

    • page_330

    • page_331

    • page_332

    • page_333

    • page_334

    • page_335

    • page_336

    • page_337

    • page_338

    • page_339

    • page_340

    • page_341

    • page_342

    • page_343

    • page_344

    • page_345

    • page_346

    • page_347

    • page_348

    • page_349

    • page_350

    • page_351

    • page_352

    • page_353

    • page_354

    • page_355

    • page_356

    • page_357

    • page_358

    • page_359

    • page_360

    • page_361

    • page_362

    • page_363

    • page_364

    • page_365

    • page_366

    • page_367

    • page_368

    • page_369

    • page_370

    • page_371

    • page_372

    • page_373

    • page_374

    • page_375

    • page_376

    • page_377

    • page_378

    • page_379

    • page_380

    • page_381

    • page_382

    • page_383

    • page_384

    • page_385

    • page_386

    • page_387

    • page_388

    • page_389

    • page_390

    • page_391

    • page_392

    • page_393

    • page_394

    • page_395

    • page_396

    • page_397

    • page_398

    • page_399

    • page_400

    • page_401

    • page_402

    • page_403

    • page_404

    • page_405

    • page_406

    • page_407

    • page_408

    • page_409

    • page_410

    • page_411

    • page_412

    • page_413

    • page_414

    • page_415

    • page_416

    • page_417

    • page_418

    • page_419

    • page_420

    • page_421

    • page_422

    • page_423

    • page_424

    • page_425

    • page_426

    • page_427

    • page_428

    • page_429

    • page_430

    • page_431

    • page_432

    • page_433

    • page_434

    • page_435

    • page_436

    • page_437

    • page_438

    • page_439

    • page_440

    • page_441

    • page_442

    • page_443

    • page_444

    • page_445

    • page_446

    • page_447

    • page_448

    • page_449

    • page_450

    • page_451

    • page_452

    • page_453

    • page_454

    • page_455

    • page_456

    • page_457

    • page_458

    • page_459

    • page_460

    • page_461

    • page_462

    • page_463

    • page_464

    • page_465

    • page_466

    • page_467

    • page_468

    • page_469

    • page_470

    • page_471

    • page_472

    • page_473

    • page_474

    • page_475

    • page_476

    • page_477

    • page_479

    • page_480

    • page_481

    • page_482

    • page_483

    • page_484

    • page_485

    • page_486

    • page_487

    • page_488

    • page_489

    • page_490

    • page_491

    • page_492

    • page_493

    • page_494

    • page_495

    • page_496

    • page_497

    • page_498

    • page_499

    • page_500

    • page_501

    • page_502

    • page_503

    • page_504

Nội dung

(table continued on next page) < previous page page_185 next page > < previous page page_186 next page > Page 186 Table 6-3. Columns in the ALL_TAB_COLUMNS View (continued) Column Name Contents SAMPLE_SIZE The number of rows that were sampled when statistics were last computed for this column.b CHARACTER_SET_NAME For character columns, this indicates which character set is stored by the column. This value will be either NCHAR_CS or CHAR_CS. NCHAR_CS indicates that data in the column is stored using the national character set. CHAR_CS indicates that the database character set is used. a Not maintained automatically by Oracle; beginning with Oracle8, you should use the ALL_TAB_COL_STATISTICS view to retrieve this value. This column is set when you use the ANALYZE TABLE command with the COMPUTE STATISTICS option. b Not maintained automatically by Oracle. This column is set when you use the ANALYZE TABLE command with the COMPUTE STATISTICS option. The ALL_CONSTRAINTS view The ALL_CONSTRAINS view returns one row for each constraint you can see. Oracle will let you see all constraints on tables you own, as well as all constraints on tables to which you have been granted any type of access. Table 6-4 lists the columns in this view. Table 6-4. Columns in the ALL_CONSTRAINTS View Column Name Contents OWNER The owner of the constraint. This is usually the same as the owner of the table on which the constraint is defined. CONSTRAINT_NAME The name of the constraint. CONSTRAINT_TYPE Indicates the type of constraint., Will be one of these values: P = PRIMARY KEY R = FOREIGN KEY C = CHECK U = UNIQUE KEY TABLE_NAME The table on which the constraint is defined. SEARCH_CONDITION If the constraint is a check constraint, this is the condition that must be satisfied for each row stored in the table. For other constraint types, this will be null. R_OWNER For foreign key constraints, this is the owner of the related primary key or unique constraint. R_CONSTRAINT_NAME For foreign key constraints, this is the related primary key or unique constraint. DELETE_RULE This has meaning only for foreign key constraints, and has these two values: CASCADE: Deleting a record from the parent table will cause matching records in this table to be deleted automatically. NO ACTION: Child records are not automatically deleted. You will not be able to delete a parent unless you first delete the children. (tabel continued on next page) < previous page page_186 next page > < previous page page_187 next page > Page 187 Table 6-4. Columns in the ALL_CONSTRAINTS View (continued) Column Name Contents STATUS Will be either ENABLED or DISABLED, depending on whether or not the constraint is currently being enforced. DEFERRABLE Will be either DEFERRABLE or NOT DEFERRABLE. DEFERRED Will be either DEFERRED or IMMEDIATE, depending on whether not the constraint is deferred by default. VALIDATED Will be either VALIDATED or NOT VALIDATED, depending on whether or not all rows in the table have been validated against the constraint. GENERATED Will be either GENERATED NAME or USER NAME depending on whether the constraint name was system-generated or specified by the user who created it. BAD Usually this is null. If this is BAD, you have used a date constant that does not include the century, and you need to recreate the constraint prior to the year 2000. LAST_CHANGE The date when the constraint was most recently changed. Since the only change you can make is to enable or disable a constraint, this ends up being when that was most recently done. The ALL_CONS_COLUMNS view The ALL_CONS_COLUMNS view contains one row for each column specified in a primary key, foreign key, or unique constraint. Table 6-5 lists the columns in this view. Table 6-5. Columns in the ALL_CONS_COLUMNS View Column Name Contents OWNER The owner of the constraint, which is the same as the owner of the table on which the constraint is defined. CONSTRAINT_NAME The name of the constraint. TABLE_NAME The table on which the constraint is defined. COLUMN_NAME The name of a column that makes up the constraint. POSITION The position of the column in the constraint definition. The ALL_INDEXES view The ALL_INDEXES view returns one record for each index you can see. You should be able to see indexes for any table to which you have been granted access. The information in ALL_INDEXES pertains to the index as a whole. To get < previous page page_187 next page > < previous page page_188 next page > Page 188 the list of columns in an index, you need to look at the ALL_IND_COLUMNS view. Table 6-6 describes the columns in ALL_INDEXES. Table 6-6. Columns in the ALL_INDEXES View Column Name Contents OWNER The username of the index's owner, which may not be the same as the owner of the underlying table. INDEX_NAME The index name. INDEX_TYPE The index type, one of the following values: NORMAL, BITMAP, CLUSTER, IOT- TOP, IOT-NESTED, SECONDARY, ANSI, or LOB. TABLE_OWNER The username of the table's owner. TABLE_NAME The name of the table on which the index was created. TABLE_TYPE The type of table which is indexed. UNIQUENESS Indicates whether or not the index is a unique index. Values are UNIQUE, NONUNIQUE, or UNDEFINED. TABLESPACE_NAME The name of the tablespace in which the index is stored. INI_TRANS The initial number of transactions. MAX_TRANS The maximum number of transactions. INITIAL_EXTENT The size, in bytes, of the next extent that will be allocated for the index. NEXT_EXTENT The size, in bytes, of the next extent that will be allocated for the index. MIN_EXTENTS The minimum number of extents for the index. This number of extents is allocated when the index is first created. MAX_EXTENTS The maximum number of extents allowed for the index. When these fill up, any attempts to index new rows will result in an error. PCT_INCREASE Each time a new extent is allocated, the NEXT_EXTENT value is increased by this percentage. PCT_THRESHOLD The percentage of block space allowed for each index entry. INCLUDE_COLUMN Applies to indexes on index-organized table, and is the column ID number of the last column to be included in the top-level index blocks. FREELISTS The number of freelists allocated to this index. FREELIST_GROUPS The number of freelist groups allocated to this index. PCT_FREE Minimum percentage of free space in a block. When free space drops to this level, Oracle stops adding new rows to the block. (table continued from previous page) < previous page page_188 next page > < previous page page_189 next page > Page 189 Table 6-6. Columns in the ALL_INDEXES View (continued) Column Name Contents LOGGING The logging attribute for the index. BLEVEL For B-Tree indexes, this is the number of different levels between the root (top) and the leaf (bottom) blocks.a LEAF_BLOCKS The number of leaf blocks contained in the index.a DISTINCT_KEYS The number of distinct index values. With a UNIQUE index, every value is a distinct value.a AVG_LEAF_BLOCKS_PER_KEY Each distinct indexed value appears in one or more leaf blocks. This is the average of the number of leaf blocks for each entry. For a UNIQUE index, this will always be 1.a AVG_DATA_BLOCKS_PER_KEY Each distinct index entry references one or more data blocks in the table. This is the average number of data blocks referenced by each entry.a CLUSTERING_FACTOR This indicates how well-ordered the table is in terms of the index. This value can range from the number of blocks in the table to the number of rows in the table. The more this value approaches the number of blocks in the table, the more closely the order of the rows in the table match the order in which they are indexed. As the rows are more randomized, this value will approach the row count for the table.a STATUS The status of the index; it has one of these values: DIRECT LOAD or VALID. A status of VALID indicates that the index is up to date and can be used. NUM_ROWS The number of rows indexed by this index.a SAMPLE_SIZE The sample used when the index was last analyzed.a LAST_ANALYZED The date on which the index was last analyzed.a DEGREE The number of threads used by each instance scanning the index. This applies only to partitioned indexes, and will be null if the index is not partitioned. INSTANCES Similar to DEGREE, but refers to the number of instances that can simulaneously scan the index. If the index is not partitioned, this will be null. PARTITIONED A YES/NO flag indicating whether or not the index is a partitioned index. TEMPORARY A Y/N flag indicating whether or not the index is a temporary index. If the index is temporary, users will only see entries for rows they have inserted. < previous page page_189 next page > < previous page page_190 next page > Page 190 Table 6-6. Columns in the ALL_INDEXES View (Continued) Column Name Contents GENERATED A Y/N flag indicating whether or not the index name was system-generated. A value of Y is used for system-generated names, which look like this: SYS_C001194. BUFFER_POOL The name of the default buffer pool to be used for the index. a Not maintained automatically by Oracle. This column is set when you use the ANALYZE TABLE command with the COMPUTE STATISTICS option. The ALL_IND_COLUMNS view Indexes are made up of one or more columns. To find out what columns are included in an index, you need to use the ALL_IND_COLUMNS view. Table 6-7 describes this view. Table 6-7. Columns in the ALL_IND_COLUMNS View Column Name Contents INDEX_OWNER The owner of the index. INDEX_NAME The name of the index. TABLE_OWNER The owner of the table that is indexed. TABLE_NAME The name of the table that is indexed. COLUMN_NAME The name of a column in the index. COLUMN-POSITION The relative position of the column in the index. The first column will be number 1, the second column will be number 2, etc. COLUMN_LENGTH The number of bytes of the column that form part of the index entry. The ALL_TRIGGERS view The ALL_TRIGGERS view returns one row for each trigger on tables you own or to which you have access. Table 6-8 describes the columns in this view. Table 6-8. Columns in the ALL_TRIGGERS View Column Contents OWNER The owner of the trigger. TRIGGER_NAME The trigger name. TRIGGER_TYPE This indicates when the trigger fires and whether or not it fires for each row. The type will be one of these values: BEFORE EACH ROW, AFTER EACH ROW, BEFORE STATEMENT, of AFTER STATEMENT. (table continued on next page) < previous page page_190 next page > < previous page page_191 next page > Page 191 Table 6-8. Columns in the ALL_TRIGGERS View (continued) Column Contents TRIGGERNING_EVENT The type of statement that fires the grigger, causing it to be executed. This will be one or more of the following: INSERT, UPDATE, DELETE. TABLE_OWNER The owner of the table on which the trigger is defined. Usually this is the same as the trigger owner, but it doesn't have to be. TABLE_NAME The name of the table on which the trigger is defined. REFERENCING_NAMES Tells you what correlation names are used in the trigger to reference columns in the table. If the defaults were taken when the trigger was created, the value for this column will be REFFERENCING NEW AS NEW OLD AS OLD. WHEN_CLAUSE The WHEN clase, if any, that was specified when the trigger was created. This will actually be the part of the WHEN clause between parentheses. Thus, if the CREATE TRIGGER statement specifies WHEN (new.hire_date = sysdate), this column will return only the new.hire_date = sysdate portion. A WHEN clause can only be specified for a row-level trigger, and the trigger only fires if this condition is true. STATUS This will be either ENABLED or DISABLED, and indicates whether or not the trigger will fire at all. DESCRIPTION This contains part of the orginal staement that was used to create the trigger. Everything following CREATE TRIGGER up until the keyword REFERENCING is stored here. This includes the trigger name, the table name, the trigger type, the triggering event, and the list of update columns. Using this field provides a more convenient way to get this information than selecting all the other columns way to get this information than selecting all the other columns separately. This is especially true if you are trying to recreate the original CREATE TRIGGER statement. TRIGGER_BODY This is a LONG column containing the PL/sql code that makes up the body of the trigger. The ALL_TRIGGER_COLS view The ALL_TRIGGER_COLS view returns one row for each database column referenced or modified in triggers on tables you own or to which you have access. I rarely use this view, but if there is ever any doubt about whether or not a trigger uses a particular database column, this view can provide a quick answer. Table 6-9 describes the columns in this view. Table 6-9. Columns in the ALL_TRIGGER_COLS View Column Contents TRIGGER_OWNER The owner of the trigger. TRIGGER_NAME The trigger name. (table continued on next page) . from the number of blocks in the table to the number of rows in the table. The more this value approaches the number of blocks in the table, the more closely the order of the rows in the table. Columns in the ALL_CONS_COLUMNS View Column Name Contents OWNER The owner of the constraint, which is the same as the owner of the table on which the constraint is defined. CONSTRAINT_NAME The name. name of the constraint. TABLE_NAME The table on which the constraint is defined. COLUMN_NAME The name of a column that makes up the constraint. POSITION The position of the column in the constraint

Ngày đăng: 05/07/2014, 04:20

TỪ KHÓA LIÊN QUAN