REGEXP_REPLACE > need to isolate only part of a string

Hello world

I hope someone can help me with this REGEXP_REPLACE building that I am on it for about 5 hours and I think I'm going crazy. :)

So, I have a field in my DB that is populated by many lines like this:

BREAKFAST 15: 00
DINNER 30.00
CITY TAX 1,50
SPA 150.00


It is an example.
The field can be filled with this information, with lines, fewer lines, can be empty.

What I have to do is to isolate only the price of the TOURIST tax. In this example, I need to get only the string "1.50'.» If the field is empty or if I don't have a line with tax, I need to go back to 0.

My test is as follows:
I made only one line and removed the spaces like this:

Replace (replace (: RATE_PACKAGES, ' ', "), Chr (10),")

Being the field of my DB RATE_PACKAGES that contain the information I need.

With this replaces 2 I have: BREAKFAST15.00DINNER30.00CITYTAX1.50SPA150.00
It's a bit ugly, but it seemed to me the best way to do it for me. :(

And after that I did a single line without spaces, here's my REGEXP_REPLACE:

regexp_replace (replace (replace (: RATE_PACKAGES, ' ', "), Chr (10),"), ' ([[: graph:]] *)([CITYTAX]) ([[: graph:]] {4})([[:graph:]]*)', '\3')

I used [[: graph:]] * to exclude all printable characters from the string before tax then [[: graph:]] {4} to isolate the 4 characters (1.50) following the TOURIST tax and finally [[: graph:]] * yet to exclude all printable characters in the string that follows the price of the TOURIST tax.
I'll be back only what I need with \3.

This works perfectly if the TAX is the last line in the field = > ' 1.50'.»
If there is something after, as in the example above, it returns = > 'PA15.

I don't understand why. And there may be a simple way to proceed?

I have tried several combinations in the REGEXP_REPLACE but I never get to get what I want. :(

Edited by: 982238 Jan 16. 2013 16:17

Hello

Are you sure that it is not working?

WITH mydata(rate_packages) AS
(
SELECT 'BREAKFAST 15.00
DINNER 30.00
Taxe de Séjour 1.50
SPA 150.00'FROM DUAL UNION ALL
SELECT 'BREAKFAST 10.00
DINNER 40.00
SPA 190.00'FROM DUAL UNION ALL
SELECT '' FROM DUAL
)
SELECT NVL(LTRIM(REGEXP_SUBSTR(rate_packages,'Taxe de Séjour +([0-9.]+)',1,1,NULL),'Taxe de Séjour '),0) City_tax_rate
FROM mydata;

CITY_TAX_RATE
-----------------------------------------------------------
1.50
0
0            

Kind regards.
Al

Tags: Database

Similar Questions

  • How REGEXP_REPLACE used to replace the part of the string?

    Hello

    How can I replace the portion of string as follows, I want to replace the space as by ' - '.

    SELECT
    REGEXP_REPLACE (superior ("' Laura bought stuff from 2000 USD on 12 September 2012 to KL and kl left on September 20, 2012"),)
    ' [0-9] {1,2} [^ 0-9](JAN|) FEB | MAR | APR | JUN | JUL | AUG | MS | OCT | NOV | DEC) [^ 0-9] [0-9] {4}',
    (','-') "REGEXP_REPLACE.
    FROM DUAL;

    the output will be like this

    Laura bought of the stuff of 2000 USD on 12-Sep-2012 of KL and kl left on 20-Sep-2012

    concerning

    Something like that?

    SELECT
    REGEXP_REPLACE('Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012',
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})',
    '\1-\2-\3',1,0,'i') "REGEXP_REPLACE"
    FROM DUAL;
    

    Explanation:

    You group the parts of the date de-construct with (additional).
    You can use expressions, backreference \1 \2 \3 and add '-' between \1-\2-\3 signs.

    You should not user upper ('...') in the first parameter. If you cannot recover the original state of the letters.
    If you want to case-insensitive matching you should use 'I' in the last parameter of regexp_replace.

    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions130.htm

    Published by: hm on 25.09.2012 00:38

  • show only part of a string of text for the field of PHP MySql

    I have a description field (tk_job_desc) on a jobsearch I mean only the first 5 lines of the description click a view read more option take the user to a new page to read, the comprehensive work plan

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via PHP_VERSION < 6) {}

    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;

    }

    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);

    Switch ($theType) {}

    case 'text ':

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "long":

    case "int":

    $theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';

    break;

    case "double":

    $theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';

    break;

    case "date":

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }

    $maxRows_Recordset1 = 5;

    $pageNum_Recordset1 = 0;

    If (isset($_GET['pageNum_Recordset1'])) {}

    $pageNum_Recordset1 = $_GET ['pageNum_Recordset1'];

    }

    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

    $var_tk_job_title_Recordset1 = '% ';

    If (isset($_GET["tk_job_title"])) {}

    $var_tk_job_title_Recordset1 = $_GET ['tk_job_title'];

    }

    $var_tk_job_location_Recordset1 = '% ';

    If (isset($_GET["tk_job_location"])) {}

    $var_tk_job_location_Recordset1 = $_GET ['tk_job_location'];

    }

    $var_tk_job_salary_Recordset1 = '% ';

    If (isset($_GET["tk_job_salary"])) {}

    $var_tk_job_salary_Recordset1 = $_GET ['tk_job_salary'];

    }

    @mysql_select_db ($database_hostprop, $hostprop);

    $query_Recordset1 = sprintf ("SELECT tk_job_title, tk_job_location, tk_job_salary, tk_job_desc FROM think_jobsearch WHERE tk_job_title LIKE tk_job_location OR AS tk_job_salary GOLD AS %s %s %s", GetSQLValueString ($var_tk_job_title_Recordset1, "text"), GetSQLValueString ($var_tk_job_location_Recordset1, "text"), GetSQLValueString ($var_tk_job_salary_Recordset1, "text") ");

    $query_limit_Recordset1 = sprintf ("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

    $Recordset1 = mysql_query ($query_limit_Recordset1, $hostprop) or die (mysql_error ());

    $row_Recordset1 = mysql_fetch_assoc ($Recordset1);

    If (isset($_GET['totalRows_Recordset1'])) {}

    $totalRows_Recordset1 = $_GET ['totalRows_Recordset1'];

    } else {}

    $all_Recordset1 = mysql_query ($query_Recordset1);

    $totalRows_Recordset1 = mysql_num_rows ($all_Recordset1);

    }

    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

    ? >

    the html code is

    < table width = "655" border = "0" cellspacing = "5" cellpadding = "0" >

    < b >

    < td colspan = "2" class = "Titlegreen" > <? PHP echo $row_Recordset1 ["tk_job_title"];? > < table >

    < /tr >

    < b >

    < td colspan = "2" class = "textblack" > <? PHP echo $row_Recordset1 ["tk_job_desc"];? > < table >

    < /tr >

    < b >

    < td width = "250" > < table >

    < td width = "405" > < div align = "right" > < span class = "pos_salary" > <? PHP echo $row_Recordset1 ["tk_job_salary"];? > < / span > < span class = "pos_location" > / <? PHP echo $row_Recordset1 ["tk_job_location"];? > < / span > < / div > < table >

    < /tr >

    < /table >

    Thank you

    > I thought LEFT(tk_job_desc,100) and tk_job_desc

    > AS %s us what he had to go to the SELECT script?

    Yes, but tk_job_desc is not actually in your SELECTION list, so you cannot reference in your php script.  What IS in your SELECTION list is a SQL function that uses tk_job_desc as a parameter. But the name of the column that is returned for this field is unknown and is certainly not tk_job_desc. You must either give it an alias, or make reference to it by its position in the select list. Then try something like:

    SELECT tk_job_title, tk_job_location, tk_job_salary, LEFT(tk_job_desc,100) as truncated_job_desc FROM think_jobsearch WHERE tk_job_title LIKE %s tk_job_location GOLD tk_job_salary GOLD tk_job_desc GOLD AS %s %s AS %s AS

    And then don't forget to use truncated_job_desc in your php script when you view the value.

  • OfficeJet Officejet Pro 8500 has more eAiO Scan to computer scans only part of the Document

    I am trying to scan my Officejet Officejet Pro 8500 has more eAiO scan to my iMac (Mac OS X 10.6.8).) IT scans only part of the document is scanned. However, when I copy it, the entire document is printed. I was looking for, if I could change this on the officet, or the system of preferences on my mac, but couldn't find anything on the 8500. On mac, I could change something, but it was only the scans on insiders from my computer.

    Scanning directly from the Officejet comes in very handy when the digitization of books, with one hand, I have to push it and the iMac is not in reach of the officejet...

    Otherwise, I am very satisfied with the printer and everything works fine...

    Thanks for any help.

    iMac (Mac OS X 10.6.8)

    Hello

    I hope you feel better now!

    Please specify the exect option that you use to scan from the control panel of the device.

    What exect icon are you clicking after selecting the scam?

    If it is computer, try to update the latest version of the driver and check if the Scan shortcuts Manager do not appear:

    Click the Apple icon, then software updated. Be sure to select any update HP available.

    If you don't see the specific option yet, you will need to delete all HP software installed completely and install the latest version:

    * Please note that the following steps will delete all HP software installed.

    1. click on menu go (click the desktop, then watch the menu in the bar at the top of the page)
    2. Select Applications
    3 select the Hewlett-Packard folder
    4. double-click on uninstall HP application
    5 follow the uninstall to prompt to select a device to uninstall
    6. press and hold Ctrl + Alt + Cmd keys on the keyboard at the same time as you click on uninstall
    7 approve any prompt to uninstall all HP software.

    Download and install the latest driver below:

    http://FTP.HP.com/pub/softlib/software11/COL34340/MP-85024-2/OJ_AIO_08_8500_A910_Net_Full_Mac_WW_74.dmg

    Finally, update the latest driver by clicking the Apple icon, then software updated.

    If you use another method of scan, please specify which option you use.

    Kind regards

    Shlomi

  • need to get the part number for fan of cooling of the laptop dv6 of my desire

    s/n [number of Series edited by Moderator]

    p/n C2L44UA #ABL

    less than two years old fan cooling makes rattling noises now, check the dust, cleaned air jet led, the still small makes fan noise rattling sound, need to get the part number and get a very convenient where the fan dies every day.

    Please help. the hp site "to find the part number" does not work, only list other pieces, but no cooling fan.

    DV6 - 7250CA

    nVidia GT630M graphics i-7 mobile quad-processor

    To be used on the computer models equipped with an Intel processor and a graphics subsystem with discrete memory 682061-001

    HP $51

    eBay $37

    eBay uses $28

    Your manual

    If it's 'the Answer' please click on 'Accept as Solution' to help others find it.

  • Reference to only part of a story?

    Hi guys,.

    In VB, I used the following to be able to find the cursor at the end of a story.

    Set Ind.Selection = Schär (1). ParentStory.Characters (Ind.Selection (1).) InsertionPoints(-1). Index)
    EChar value = Ind.Selection (1). ParentStory.Characters(-1)
    Set SrchTxt = Ind.Selection (1). ParentStory.Texts.ItemByRange (Schär, EChar)

    I'm assuming that I would be able to browse the SrchTxt.Paragraphs also, but whatever the object type SrchTxt ends up being is not 'Paragraphs' as a property.

    I want to iterate through a part of history by paragraph and according to certain criteria, one of them being the style applied to the paragraph, stop if the user performs the action.

    How to refer to only part of a story, or understanding, in which the paragraph in a story, the cursor is planted the script at startup?

    Thank you very much

    Ken

    Hi Ken

    As substances said - you need to refer to the first element of the result of ItemByRange.

    And you are not limited to the characters as params. Texts.ItemByRange(start,end) - you can use any text, start, end - PointInsertion object, character, Word, etc. - but you can not use some numbers-text is only by each text element

    If you need to refer to the "current": paragraph

    Set myCurPara = myInDi.Selection.Item (1). Paragraphs.Item (1)

    Robin

    www.adobescripts.co.UK

  • REGEXP_REPLACE problem/bug - replaces only each second occurrence

    Hi all


    I use

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    I need a regular expression to rename a variable in a mathematical formula, when testing my code that I discovered that if the variable was repeated after himself that a single occurrence has been replaced. I need to replace only whole words as some variables can be a subset of a variable name longer, and variable names can have underscores in them.
    Here is an example of what happens.

    Is someone can you please tell me why this happens? Example code is:

    SELECT REGEXP_REPLACE (' ab ab ab + ab + ab + ab + ab + abc + abc + ab ", '(\W|^)ab(\W|$)', '\1xy\2',1,0,'i') from DUAL;

    The regular expression matches all the "ab" with a start line or a non alphabetical character before and not alpha or end of line at the end.

    I have then replace the "ab" by "xy" and keep the original alpha not on each side. What happens is that only every second occurrence is replaced.
    If I put a space after each '+', and then it replaces all occurrences. (Of course, this is a domain user in a table of mathematical formulas so I can not wait to the user to worry about this problem.)

    I think that this may be due to the fact the pointer in conclusion any occurrence is moved correctly and it does not find the game immediately after.

    Can someone please explain this? Or did I miss something in my example.

    Thank you
    Dudley

    I don't think it's a bug, at least comparable re in python produces the same result:

    import re
    s="ab+ab+ab+ab+ab+ab+ab+abc+abc+ab"
    print re.sub(r"(\W|^)ab(\W|$)",r"\1xy\2",s)
    xy+ab+xy+ab+xy+ab+xy+abc+abc+xy
    

    If you have a match in your regular expression, the next probe will be launched after the game, it's how the regular expression works (at least IMHO).
    In your example the corresponding characters are "+ ab + (except the beginning of the line, end of line), that's why next occurency"ab"is not equal to."
    If you want to replace all"in Alberta, you could make the model as

    SELECT REGEXP_REPLACE('ab+ab+ab+ab+ab+ab+ab+abc+abc+ab', '(\W|^)?ab(\W|$)' , '\1xy\2',1,0,'i') from DUAL;
    

    Best regards

    Maxim

    Published by: Maxim Demenko, 14 July 2009 14:09
    fixed formatting

  • Password protect only part of my block diagram

    Hello.

    Is it possible to protect only part of a diagram of bloack labview? I want people to use the VI and be able to make changes, but some parts (Sub VI) I already did and should not be changed.

    With greetings

    Espen

    Make the parts that you want to protect into subVIs and password those.

    Lynn

  • need to get only one line when you use between (date columns)

    Hi all

    create the table SAMPLE_ITEMS

    (ITEM_NO, varchar2 (10))

    Date DELIVERY_DATE,

    Number of QTY_SUM1

    Number of QTY_SUM2

    Number ITEM_QTY,

    Number ORDER_QTY,

    Number ITEM_AMOUNT,

    Number of SALES_AMOUNT

    );

    insert into SAMPLE_ITEMS values ('AAA', ' 28 / 04/2014 ',-88, 0,475,262,-123.45,-1188);

    insert into SAMPLE_ITEMS values ('AAA', ' 28 / 05/2014 ', 0, - 122, 475, 262, - 10.234,-1647);

    insert into SAMPLE_ITEMS values ('AAA', ' 16 / 06/2014. ', 0, 0,475,262,-80.59,-135);

    insert into SAMPLE_ITEMS values ('AAA', 19 December 2014 ', 0, 0,475,262,-42.29,-67.5);

    Setting out with my own query,

    ITEM_NOTRUNC (DELIVERY_DATE)QTY_SUM1QTY_SUM2ITEM_QTYORDER_QTYITEM_AMOUNTSALES_AMOUNT
    AAA28/04/2014-880475262-123.45-1188
    AAA28/05/20140-122475262-10.234-1647
    AAA16/06/201400475262-80.59-135
    AAA19/12/201400475262-42.29-67.5

    Every time I question as code

    Select * from SAMPLE_ITEMS

    where DELIVERY_DATE between April 28, 2014 ' and 19 December 2014 '-> they must pass as a parameter

    I need to get only one line

    AAA-88-122475262-256.564-3037.5

    Database 11.2.0.1.0

    Note; Please do not use MAX for Date and do not want to display Date columns in the result

    Note 1: I want to choose DELIVERY_DATE in select it also and only get a line like above the expected result

    SELECT item_no

    SUM (qty_sum1),

    SUM (qty_sum2),

    SUM (DISTINCT item_qty),

    SUM (DISTINCT order_qty),

    SUM (item_amount),

    SUM (sales_amount)

    OF SAMPLE_ITEMS

    WHERE the DELIVERY_DATE BETWEEN TO_DATE (28 April 2014 ', "dd/mm/yyyy")

    AND TO_DATE (19 December 2014 ', "dd/mm/yyyy")

    GROUP BY item_no;

    I will get

    ITEM_NO Trunc (DELIVERY_DATE) QTY_SUM1 QTY_SUM2 ITEM_QTY    ORDER_QTY TTEM_AMOUNT SALES_AMOUNT        

    AAA             12/19/2014                         -88                 -122                475                262                       -256.564              -3037.5

    OK fine, I want to choose DELIVERY_DATE as if so I'll have all the lines, but I want to only show one as shown above

    Because I do report discoverer in Oracle Apps, without taking the DELIVERY_DATE of the select query, it is not possible to move the date as a parameter

    Can you please help me how to do this?

    Thank you

    Post edited by: Rajesh123 NOTE added in the body of the Message

    Post edited by: added test Rajesh123 messages

    Maybe you want a single line in all cases

    Select si.item_no,

    start_date min (d.start_date),

    min (d.end_date) end_date,

    min (si.qty_sum1) qty_sum1,

    min (si.qty_sum2) qty_sum2,

    min (si.item_qty) item_qty,

    min (si.order_qty) order_qty,

    Sum (si.item_amount) item_amount,

    Sum (if. Sales_Amount) sales_amount

    of (start_date select to_date(:date_from,'dd-MON-yyyy'))

    to_date(:date_to,'dd-mon-yyyy') end_date

    of the double

    ) d

    left outer join

    TR sample_items

    on the si.delivery_date between d.start_date and d.end_date

    Group of item_no

    ITEM_NO START_DATE END_DATE QTY_SUM1 QTY_SUM2 ITEM_QTY ORDER_QTY ITEM_AMOUNT SALES_AMOUNT
    - 01/01/1900 31/12/2000 - - - - - -

    Concerning

    Etbin

  • I need to register cs2 once again, I need to use the part of the program bridge

    I need to register cs2 once again, I need to use the part of the program bridge

    There is nothing you can do to save your version/copy of CS2.  There is a special version for those who own CS2 and need to reinstall.  Infos and downloads are available through the following:

    CS2: Error: unavailable activation server | CS2, Acrobat 7, hearing 3 -.

    l http://helpx.adobe.com/x-productkb/Policy-Pricing/Creative-Suite-2-activation-end-Life.htm

    https://helpx.Adobe.com/Creative-Suite/KB/CS2-product-downloads.html

  • How do print you only part of a PDF file once it is open?

    How do print you only part of a PDF file once it is open?

    In the print dialog box to open more Options (under the Page to print) and select 'view '.

  • I reside in the UAE UNITED from now, but in 6 months, I can move to another country, so my plan of photography 1 year will be? I need to buy only after getting a response to my request. Thank you

    I reside in the UAE UNITED from now, but in 6 months, I can move to another country, so my plan of photography 1 year will be? I need to buy only after getting a response to my request. Thank you

    Oh, one last thing, or is - it possible to buy sitting in the UNITED Arab Emirates, but giving details on the country that I will propose to (Canada) (connecting to Adobe, Canada)

    Hello

    You are fine as long as the country of your Adobe ID and country of your credit card match; and the country is one that we support for a creative cloud subscription. The fact that you are in a different country now is ok.

    Kind regards

    Sheena

  • How can I cancel my account when the need help page only allows me to go to forums and does no real contact for adobe?

    How can I cancel my account when the need help page only allows me to go to forums and does no real contact for adobe? How can I contact Adobe actually?

    Please contact support by calling/chat for cancellation requests and billing queries:

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    You can also check the help below document:

    https://helpx.Adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

    Please go through the Adobe - General conditions of subscription as well.

    Concerning

    Stéphane

  • Is Acrobat Pro just for us. We have an employee handbook that needs editing. A part is current pdf, some of an earlier version. You want to get all in a manual, the table of contents automatically adjust and links to specific pages of the table of content

    Is Acrobat Pro just for us. We have an employee handbook that needs editing. A part is current pdf, some of an earlier version. You want to get all in a manual, the table of contents automatically adjust and links to specific pages of the table of contents.

    Acrobat Pro is certainly not the right tool for editing. You want to change the manual using the source - MS Word files for example. Once you have the full changes including OCD work as you want, Acrobat Pro is the tool to convert the source document to PDF format, and ensure the accessibility requirements of 508 - and preferably ISO 14289 (PDF/UA) - are met.

  • you need to recover only one type of phone number

    Hello

    In the following example query, I need to recover only one phone number. The preference is if available Mobile - mobile phone number if this is house number (Type - H1), work a different number (W1).

    I've included the script and the sample output that I get from the SQL

    Thanks in advance

    Concerning
    Sriram
    select pp.ph_id
    ,papf.person_id
    ,pp.ph_type
    ,pp.ph_no
    ,pp.date_from
    ,pp.date_to
    from per_phones                      pp
    ,per_all_people_f                    papf
    ,per_contact_relationships           pcr
    where papf.person_id = pp.parent_id
    and pcr.person_id = papf.person_id
    and trunc(sysdate) between trunc(nvl(pcr.date_start, sysdate-1))
    and trunc(nvl(pcr.date_end, sysdate+1))
    and papf.person_id in (146564, 514)
    and pcr.primary_contact_flag  = 'Y'
    and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    and trunc(sysdate) between nvl(pp.date_from, sysdate-1) and nvl(pp.date_to, sysdate+1);
    output
    PH_ID     PERSON_ID     PH_TYPE     PH_NO     DATE_FROM     DATE_TO
    3261     514          H1          987524879     13-Jun-04     
    117287     514          M          0403672797     11-May-05     
    141997     146564          H1          54789620     15-Feb-06     05-Mar-10
    311028     146564          H2          235469          5-Dec-09     
    311029     146564          W1          8300054          15-Dec-09     
    311108     146564          M          04126872     12-Feb-10

    You can also try

     select max(pp.ph_id) keep (dense_rank first order by decode(pp.ph_type, 'M',1,'H1',2, 'W1',3), ph_id,
           pp.person_id,
           max(pp.ph_type) keep (dense_rank first order by decode(pp.ph_type, 'M',1,'H1',2, 'W1',3), ph_type,
           max(pp.ph_no) keep (dense_rank first order by decode(pp.ph_type, 'M',1,'H1',2, 'W1',3), ph_no,
           max(pp.date_from) keep (dense_rank first order by decode(pp.ph_type, 'M',1,'H1',2, 'W1',3), date_from,
           max(pp.date_to) keep (dense_rank first order by decode(pp.ph_type, 'M',1,'H1',2, 'W1',3),date_to
      from per_phones pp, per_all_people_f papf, per_contact_relationships pcr
     where papf.person_id = pp.parent_id and pcr.person_id = papf.person_id
           and trunc (sysdate) between trunc (nvl (pcr.date_start, sysdate - 1)) and trunc (nvl (pcr.date_end, sysdate + 1))
           and papf.person_id in (146564, 514)
           and pcr.primary_contact_flag = 'Y'
           and trunc (sysdate) between papf.effective_start_date and papf.effective_end_date
           and trunc (sysdate) between nvl (pp.date_from, sysdate - 1) and nvl (pp.date_to, sysdate + 1)
    group by pp.person_id;
    

    Published by: michaels2 on February 25, 2010 08:50

    probably, you want to just group by person_id

Maybe you are looking for