Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    3

    Question Unanswered: select inside select

    Hi there, I am porting my code (Java) from MS-SQL to Oracle, and the following statement doesn't work on Oracle

    SELECT RTC_RESOURCE_NAME FROM RESOURCES_TREE_CONF WHERE RTC_RESOURCE_ID
    LIKE ((SELECT RTC_RESOURCE_ID FROM RESOURCES_TREE_CONF WHERE RTC_RESOURCE_NAME = 'CUSTOMER') + '%')

    Basically it complains about the inner select (I think).

    Can anyone help? This pattern repets itself alot!

    Oren

  2. #2
    Join Date
    Dec 2003
    Posts
    3
    BTW, this one works...

    SELECT RTC_RESOURCE_NAME FROM RESOURCES_TREE_CONF WHERE RTC_RESOURCE_ID
    LIKE (SELECT RTC_RESOURCE_ID FROM RESOURCES_TREE_CONF WHERE RTC_RESOURCE_NAME = 'CUSTOMER')

  3. #3
    Join Date
    Dec 2003
    Posts
    3
    Originally posted by ogross
    BTW, this one works...

    SELECT RTC_RESOURCE_NAME FROM RESOURCES_TREE_CONF WHERE RTC_RESOURCE_ID
    LIKE (SELECT RTC_RESOURCE_ID FROM RESOURCES_TREE_CONF WHERE RTC_RESOURCE_NAME = 'CUSTOMER')
    So, what actualy is giving me the problem is the +'%'

  4. #4
    Join Date
    Dec 2003
    Location
    Noida, India.
    Posts
    171
    In Oracle contenation is done using ||
    If you want to concatenate % to your value on RHS, you would need to do

    Col like 'X' || '%'

    in your case it is
    Col like 'select x from xyz' || '%'




    Originally posted by ogross
    So, what actualy is giving me the problem is the +'%'
    Oracle can do wonders !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •