DB2 Faq's

Question: How do you debug a DB2 STORED PROCEDURE

Answer: I want someone to answer it.

Question: maxx number of columns in a db2 table

Answer: 224

Question: What is RUNSTATS command in DB2?

Answer: .

Question: Question: Question: I need to view the number of tables existing under one particular Owner. Is it possible? If so, pl give the SQL query for this?

Answer: The query SELECT * FROM SYSIBM.SYSTABLES WHERE CREATOR = 'owner id' This displays the table names with that If you want only the number of tables give the following query. SELECT COUNT(*) FROM SYSIBM.SYSTABLES WHERE CREATOR = 'owner id' Make sure that you are in correct subsystem.

Question: Question: I need to view the number of tables existing under one particular Owner. Is it possible? If so, pl give the SQL query for this?

Answer: The query SELECT * FROM SYSTABLES WHERE OWNER= should work.

Question: Question: I need to view the number of tables existing under one particular Owner. Is it possible? If so, pl give the SQL query for this?

Answer: Answer to Ravi's query: Db2 records information for its operation in a catalog which is actually a group of tables. So we can use the SYSTABLES to get answer to ur query. So

Question: I need to view the number of tables existing under one particular Owner. Is it possible? If so, pl give the SQL query for this?

Answer: Can any one give me the answer for this?

Question: I need to view the number of tables existing under one particular Owner. Is it possible? If so, pl give the SQL query for this?

Answer: Can any one give me the answer for this?

Question: What is JOIN and different types of JOIN.

Answer: The ability to join rows and combaine data from two or more tables is one of the most powerful features of relational system.Three type of joins:1. Equi-join2.Non-equijoin3.self-join

Question: can I alter a table (e.g. adding a column) when other user is selecting some columns or updating some columns from the same table?

Answer: yes possible. until the updation or selection is commited db2 table will not be restructured. new column definition will be there but it will not be included until all the tasks on the table are commited.

Question: How many subqueries can you combine together ?

Answer: Total 16 queries and subqueries are 15

Question: A. What are the different methods of accessing db2 from tso?B.How is the connection established between TSO & DB2?

Answer: A. There are three ways in establishing tso/db2 connection 1. SPUFI 2. QMF 3. CATALOG VISIBILITY B. A thread between TSO & DB2 is established while attempting to make connection between tso & db2.

Question: How many buffer bools are available in db2?

Answer: ten 32k size bufferpools and fifty 4k size buffer pools (bp0 to bp49)default buffer pools are bp0,bp1,bp2 & bp32

Question: b37 abend during spufi

Answer: the b37 abend in the spufi is because of space requirements , the query has resulted in so many rows that the spufi.out file is not large enough to handle it, increase the space allocation of spufi.out file.

Question: How many Bufferpools are there in DB2 and what are they?

Answer: There are 4 Bufferpools.They are BP0,BP1,BP2 and BP32.

Question: What is the command used by TSO users to invoke DB2?

Answer: DSN RUN

Question: what is the error code -803 ?

Answer: unique index violation

Question: How do you install DB2

Answer: Install DB2 according to the procedure fo the manual

Question: how do you filter out the rows retrieved from a Db2 table ?

Answer: one way is to use The Sql WHERE clause.

Question: what is a collection?

Answer: A collection is something that every programmer should assign/Specify for every package. this about 1-18 characters long.

Question: What is Skeleton cursor table (SKCT)?

Answer: The Executable form of a Plan. This is stored in sysibm.sct02 table.

Question: what's the equivalent Cobol Data type for Decimal(x,y) in DB2? what does the current SQLID register contain?

Answer: Pic s9(x-y)V9(Y) Comp-3; the current SQLID contains the current authorization ID.

Question: Can we declare DB2 HOST variable in COBOL COPY book?

Answer: NO.If we declare DB2 host variable in COBOL COPY book, at the time of Pre-compilation we get the host variable not defined, because pre-compiler will not expand COBOL COPY book. So we declare it either in DCLGEN with EXEC SQL INCLUDE Dclgenname END-EXEC or we directly hardcode it in the working storage section.

Question: What should be specified along with a cursor in order to continue updating process after commit?

Answer: With Hold option.

Question: WHAT IS THE NAME OF THE DEFAULT db2 CATALOG DATABASE?

Answer: DSNDB06

Question: When Can you be sure that a query will return only one row?

Answer: When you use the primary key and only the primary key in the where clause.

Question: what is the difference between join and union?

Answer: join is used to retrive data from different tables using a single sql statement.union is used to combine the results of two or more sql querries.

Question: What is a corelated subquerry?

Answer: In a subquerry, if the outer querry reffers back to the outcome of innerquerry it is called corelated subquerry. That's why the outer querry is evaluated first unlike an ordinary subquerry

Question: What are the functions of Bind?

Answer: BIND mainly performs two things syntax checking and authorization checking.It binds together all packages into an application plan hence the name BIND.Apart from this bind has optimiser as a subcomponent.Its function is to determine the optimum access strategy.

Question: MAX. NO OF ROWS PER PAGE

Answer: 127

Question: The only place of VSAM KSDS in DB2 is?

Answer: BSDS is a VSAM KSDS.

Question: CAN ALL USERS HAVE THE PRIVILAGE TO USE THE SQL STATEMENT SELECT * (DML)?

Answer: NO THE USER SHOULD BE GRANTED PRIVILAGE TO USE IT.

Question: What is the size of a data page?

Answer: 4K to 8K

Question: what's the best locksize that you could use when you create a tablespace?

Answer: The answer is Locksize = ANY.Unless you are Sure what's the Purpose of tablespace ie.,Read-only or R/W.If you use lock size =any, Db2 would automatically determine what type of locks it should use.

Question: what's the error code for Unique Index Voilation:

Answer: -803

Question: what's the percentage free space for

Answer: ZERO

Question: Can you define an Index if the table size less than 10 PAGES?

Answer: the Answer is : NO

Question: What's the Maximum Length of SQLCA and what's the content of SQLCABC?

Answer: The Max length is 136. and the SQLCABC has the Value of SQLCA.

Question: what's the percentage free space for

Answer: The answer is ZERO.

Question: What's the maximum number of volumes that can be added to a STOGROUP?

Answer: The answer is 133.Usually it will be difficult monitor more than 3 or 4 volumes to a Stogroup.

Question: What's the maximum number of characters that a tablename can have?

Answer: The answer is 18 characters.

Question: What is the meaning of -805 sql return code?

Answer: Program name not in plan. Bind the plan and include the DBRM for the program named as part of the plan.

Question: when does the sql statement gets executed when you use cursor in the application programming ?

Answer: sql statement gets executed when we open cursor

Question: What does CURRENTDATA option in bind indicate

Answer: CURRENTDATA option ensures block fetch while selecting rows from a table. In DB2V4 the default has been changed to NO. Therefore it is necessary to change all the bind cards with CURRENTDATA(YES) which is default in DB2V3 & earlier to CURRENTDATA(NO).

Question: What is the difference between TYPE 1 index & TYPE 2 index

Answer: TYPE 1 & TYPE 2 are specified when an index is created on the table. TYPE 2 index is the option which comes with DB2V4. With TYPE 2 index data can be retreived faster as only the data pages are locked and not the index pages. Hence TYPE 2 index is recommended.

Question: What are the levels of isolation available with DB2V4

Answer: CS RR UR( added new for DB2V4 which stands for uncommited read which allows to retreive records from the space which has exclusive locks also but data integrity will be affected if this option is used )The best available option for data integrity & data concurrency is CS.

Question: How do you achieve record locking in DB2 in the versions which donot support record level locking?

Answer: Y'day I had posted this que. The answer shud hv read as follows:By having the record length more than half of the page size !Sorry again& Thanx

Question: How do u achieve record level locking in DB2 versions when record level locking is not allowed?

Answer: By having the length of the record greater than that of a page!

Question: In a DB2-CICS program which is acts as co-ordinator and which is participant?

Answer: DB2 - participant CICS- coordinator

Question: What does DML stand for and what are some examples of it?

Answer: Data Manipulation Language. Some examples are SELECT, INSERT, DELETE, REPLACE.

Question: How to define the dataitems to receive the fetch items for the SQL?

Answer: Using the DSECT, followed by lines of - 'dataitems DS datatype'.

Question: Re:How will you delete duplicate records from a table?

Answer: Delete From Table1Where Id In (Select Id From Tabel1 As Temp Group By Id Having Count(*) >1)

Question: What is the difference between Where and Having Clause

Answer: WHERE is for Rows and HAVING is for Groups

Question: How to see the structure of db2 table??

Answer: Using QMF.

Question: How do you declare a host variable (in COBOL) for an attribute named EMP-NAME of type VARCHAR(25) ?

Answer: 01 EMP-GRP. 49 E-LEN PIC S9(4) COMP. 49 E-NAME PIC X(25).

Question: What is the maximum number of tables that can be stored on a Partitioned Table Space ?

Answer: ONE

Question: Name the different types of Table spaces.

Answer: 1. Simple Table Space2. Segmented Table Space and3. Partitioned Table Space

Question: what are the max. & min. no. of partitions allowed in a partition tablespace?

Answer: minimum is 4.maximum is 64.

Question: what is the maximum number of tables that can be joined ?

Answer: fifteen

Question: What technique is used to retrieve data from more than one table in a single SQL statement?

Answer: The Join statement combines data from more that two tables

Question: What is a foreign key?

Answer: It identifies a releated row in another table and establishes a logical relationship between rows in two tables.

Question: Explain the use of the WHERE clause.

Answer: It directs DB2 to extract data from rows where the value of the column is the same as the current value of the host variable.

No comments: