Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Like parameter in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Nov 28, 2007 4:57 pm    Post subject: Like parameter in DB2
Reply with quote

How to retrieve records having % in a field using DB2 Like parameter

Example:
PCT
10%
100%
20
Back to top
View user's profile Send private message

muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Wed Nov 28, 2007 5:03 pm    Post subject: Reply to: Like parameter in DB2
Reply with quote

To search for a % or an _ as a literal part of your string, use the ESCAPE clause

Example-
Code:

   SELECT EMPNO, EMPNAME, WORKDEPT             FROM    EMP                                                            WHERE EMPNAME LIKE ‘ANURAG+_KAPOOR%'
                   ESCAPE ‘+’
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Nov 28, 2007 5:43 pm    Post subject:
Reply with quote

MGayathri,

I think your requirement is to retrieve the records that have character "%" in any position in the column data.

If yes, please check with the following code for your requirement as muthuvel suggested.

Code:
SELECT COLUMN_NAME FROM TABLE_NAME  WHERE COLUMN_NAME LIKE '%+%%' ESCAPE '+'
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Nov 28, 2007 10:25 pm    Post subject:
Reply with quote

Muthuvel and Shanker.. Thanks a lot..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Regarding time parameter shanthi gude JCL & VSAM 7 Mon Sep 04, 2017 2:31 pm
No new posts Paasing symbolic parameter to instrea... Robert Sample JCL & VSAM 2 Thu Jul 27, 2017 1:22 pm
No new posts JTS parameter Shashank Chaubey JCL & VSAM 2 Thu Jul 13, 2017 4:15 pm
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
No new posts Can DFSPARM override SORTKEYS paramet... ashek15 DB2 2 Tue Jan 31, 2017 11:36 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us