Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    4

    Unanswered: Splitting a string (not a simple SUBSTR!!)

    I have already posted with this problem but I have finally cleared up what it ias I think I need to do.

    Can I split a string returned from a function into 2 seperate parts whilst only invoking the function once. And ythis is from within a SQL select.

    I can only manage 2

    SELECT
    SUBSTR(myfunction,1,10) value1,
    SUBSTR(myfunction,11,20) value2
    from dual

  2. #2
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208

    Re: Splitting a string (not a simple SUBSTR!!)

    How about

    PHP Code:
    Select Substr(a.txt,1,10Value1,
              
    Substr(a.txt,12,20Value2
    From 
    (Select myFunction txt from Dual

  3. #3
    Join Date
    Nov 2003
    Posts
    4
    I tried a select from a select but there was no performance change hence I assumed it was still calling the function twice. Doesn't a select from select simply alias the sub-query?

  4. #4
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208
    The select wrapped around a select calling the function should execute the function only once.

    Check out the explain plan to see why the query is not performing well.

    HIH

  5. #5
    Join Date
    Sep 2003
    Location
    Colombo, Sri Lanka
    Posts
    63

    Re: Splitting a string (not a simple SUBSTR!!)

    If you are using the select in a PL\SQL block you can directly use the inbuilt functions without using a select statement.

Posting Permissions

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