Hi i need to write a query on the following requirement.

SELECT COMM_TEXT
INTO :WS_MIKM_COMM_TEXT
FROM MPIPROD.MIKMV01
WHERE ACCOUNT_NO = :WFD_ACCOUNT_NO
AND (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT
AND SUBSTR(COMM_TEXT,47,14) = :WS_DENY_DESC)
OR (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT)

The above query is to be modified. The requirement is if
both the fields are equal then that has to be given
priority. In the above query if it satisfies any one it
comes out without checking if both being equal is possible.



Hi i need to write a query on the following requirement. SELECT COMM_TEXT ..

Answer / satish

SELECT COMM_TEXT
INTO :WS_MIKM_COMM_TEXT
FROM MPIPROD.MIKMV01
WHERE (CASE WHEN (SUBSTR(COMM_TEXT,1,39 = :WS_COMMENT_TEXT)
AND SUBSTR(COMM_TEXT,47,14) = :WS_DENY_DESC)) THEN 1
ELSE
(SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT) THEN 2
END) IN (1,2)
AND ACCOUNT_NO = :WFD_ACCOUNT_NO


Tell me if i am wrong??


ACCOUNT_NO = :WFD_ACCOUNT_NO
AND CASE
OR (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

in column y record abc.v abc.s xyz.j abc.h i wan only abc columns how to retrieve thi records

2 Answers   IBM,


What is the maximum size of a char data type in db2?

0 Answers  


i have one file having 100 of records? i want to display it like 20 records in one column and 20 records in another column total 40 records per page ? how ?

2 Answers   EDS,


query to just fetch first matching row and stop execution. once one matching row is found ..no more records should be checked.. if the first record is matching.. the query must stop

2 Answers   IBM,


Could you please let me no the query for below I have table name xyx under this there is column name called employee name which starts from 100th column ends 120th column,now i want to replace only column from 101 to 104 which contains ABCS to replace with PQRS for all records which comes beetween 101 to 104 ..how to write query for this..

1 Answers   HSBC,






4. A DB2 application is bound with uncommitted Read isolation level.It issues a request that retrieves 20 rows out of 200000 in the table. Which of the following descrbes the rows that are locked as a result of this request? a. None of the rows are locked. B.The retrieved rows are locked. C.The last row of the result set is locked. D.The rows not previously updated by another application are locked.

3 Answers   Wipro,


Where is the output of EXPLAIN stored?

2 Answers  


When can an insert of a new primary key value threaten referential integrity?

2 Answers   Mind Tree,


What is the difference between bind and rebind in db2?

0 Answers  


What does db2 stand for?

0 Answers  


Is it possible to update a primary key value? If not, what is the error code given? If yes, can more than 1 primary key column be updated at a time?

8 Answers  


What is clone table?

0 Answers  


Categories