Where V1 In (select Fun(1)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maddurivenkys
    New Member
    • Nov 2007
    • 2

    Where V1 In (select Fun(1)

    Hi All,

    I wrote a function which will return varchar i.e '10','11','12', '13' and I am passing this value in IN cluase in SELECT query as
    [code=oracle]
    SELECT * FROM VV WHERE V1 IN (SELECT FUN(1) FROM DUAL).
    [/code]

    Where, FUN(1) is my function name, which accpets NUMBER as IN parameter and it will return VARCHAR. i.e '10','11','12', '13' .

    When I ran the above query I am getting 'no results found'. But when I ran the query as
    [code=oracle]
    SELECT * FROM VV WHERE V1 IN ('10','11','12' ,'13' ) -- I am getting the result.
    [/code]
    Can any one help me.

    Thanks in Advance.
    Last edited by amitpatel66; Nov 22 '07, 04:40 AM. Reason: code tags
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Hi,

    Welcome to TSDN!!

    Make sure you follow POSTING GUIDELINES every time when you post in the forum.

    Thanks

    MODERATOR

    Comment

    • amitpatel66
      Recognized Expert Top Contributor
      • Mar 2007
      • 2358

      #3
      Please enclose your posted code in [code] tags (See How to Ask a Question).

      This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

      Please use [code] tags in future.

      MODERATOR

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by maddurivenkys
        Hi All,

        I wrote a function which will return varchar i.e '10','11','12', '13' and I am passing this value in IN cluase in SELECT query as
        [code=oracle]
        SELECT * FROM VV WHERE V1 IN (SELECT FUN(1) FROM DUAL).
        [/code]

        Where, FUN(1) is my function name, which accpets NUMBER as IN parameter and it will return VARCHAR. i.e '10','11','12', '13' .

        When I ran the above query I am getting 'no results found'. But when I ran the query as
        [code=oracle]
        SELECT * FROM VV WHERE V1 IN ('10','11','12' ,'13' ) -- I am getting the result.
        [/code]
        Can any one help me.

        Thanks in Advance.
        Please POST your function that you have implemented for our experts reference?

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Hi,

          Check whether VV table has got records for V1 field ='10'... as per the condition.
          May be it dosent have any matching records (as given in Where condition) so, you are getting No Results Found ..

          Regards
          Veena

          Comment

          Working...