address query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hgriva
    New Member
    • Aug 2006
    • 8

    address query

    hi,
    i have a table called address
    whose structure is
    adr number
    street_number varchar2(50

    there are recoords like

    9999 0000045
    9991 45
    9992 0001045
    9993 0010045

    the user would enter say 45 on the front end java screen and the
    query has to fetch records of street_number 45 as well as 0000045
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to use LIKE in the search .

    try to use

    select ............... ............... ..where ............... like ('%45')

    Comment

    • hgriva
      New Member
      • Aug 2006
      • 8

      #3
      Originally posted by debasisdas
      You need to use LIKE in the search .

      try to use

      select ............... ............... ..where ............... like ('%45')
      No it would fetch me records whose street number would be like

      0000045
      0000145
      0001045

      But i want only 45 and 0000045 to be returned.

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by hgriva
        No it would fetch me records whose street number would be like

        0000045
        0000145
        0001045

        But i want only 45 and 0000045 to be returned.
        Try

        SELECT......... ...........WHER E.............. ='45' OR............. ..LIKE '%0045'

        Could you please explain your requirement in detail to why you need to do this?

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Hi,

          Try this :

          [code=oracle]
          Select * From MyTable Where adr Like '% 45' Or adr Like '%0000045'
          [/code]


          Regards
          Veena

          Comment

          Working...