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

What do you do to keep the cursor from closing after a commit?

1 Answers  


What is the use of predicate?

0 Answers  


How can we define a table? How can we apply SEARCH ALL on it ?

1 Answers  


Return code 100 means?

6 Answers   Cap Gemini,


What are catalog tables in db2?

0 Answers  






Write a query to extract first 5 characters of a name in the column Stud_Name?

1 Answers   RBS,


What is a db2 collection?

0 Answers  


What is a base table?

2 Answers  


What does CURRENTDATA option in bind indicate

1 Answers   IBM,


What is db2 connect?

0 Answers  


What is JOIN and different types of JOIN.

2 Answers   IBM,


How can you display the current date & current time ?

7 Answers   Cap Gemini,


Categories