How to get the difference between these two dates

Hello Friends,
I need to get the difference between these two fields which store dates but with varchar2 data types
SELECT pac.segment1, pac.segment2 emp_no, pac.segment3 NAME,
pac.segment4 POSITION, pac.segment5 start_date, pac.segment6,
pac.segment7
FROM per_analysis_criteria pac, fnd_id_flex_structures_vl ffs
WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
AND ffs.id_flex_num = pac.id_flex_num
AND TO_CHAR (TO_DATE (pac.segment7, 'YYYY/MM/DD HH24:MI:SS'))
- TO_CHAR (TO_DATE (pac.segment6, 'YYYY/MM/DD HH24:MI:SS')) > 1;
my query is something like this...
am trying to find the difference between the last two columns but with not much luck..
can some one suggest me a solution please

SELECT pac.segment1, pac.segment2 person_id, pac.segment3 NAME,
papf.employee_number, paaf.supervisor_id, pac.segment4 POSITION,
pac.segment5 start_date, pac.segment6, pac.segment7,
papf2.email_address,
( TO_DATE (TO_CHAR (pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')
- TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')
+ 1
) difference,
POST.email_address
FROM per_analysis_criteria pac,
apps.fnd_id_flex_structures_vl ffs,
per_all_people_f papf,
per_all_assignments_f paaf,
per_all_people_f papf2,
(SELECT email_address, person_id
FROM per_all_people_f
WHERE person_id IN (
SELECT person_id
FROM per_all_assignments_f
WHERE position_id IN (SELECT position_id
FROM per_positions
WHERE NAME LIKE 'HR Manager.704.')
AND TRUNC (SYSDATE) BETWEEN effective_start_date
AND effective_end_date)
AND TRUNC (SYSDATE) BETWEEN effective_start_date AND effective_end_date
AND business_group_id = fnd_profile.VALUE ('PER_BUSINESS_GROUP_ID')) POST
WHERE ffs.id_flex_structure_code = 'Employee Rejoin'
AND TO_CHAR (papf.person_id) = pac.segment2
AND ffs.id_flex_num = pac.id_flex_num
AND TRUNC (SYSDATE) BETWEEN papf.effective_start_date
AND papf.effective_end_date
AND papf.current_employee_flag = 'Y'
AND papf.person_id = paaf.person_id
AND TRUNC (SYSDATE) BETWEEN paaf.effective_start_date
AND paaf.effective_end_date
AND papf.person_id = paaf.person_id
AND papf2.person_id = paaf.supervisor_id
AND paaf.primary_flag = 'Y'
AND TRUNC (SYSDATE) BETWEEN papf2.effective_start_date
AND papf2.effective_end_date
AND papf2.current_employee_flag = 'Y'
and ( TO_DATE(to_char(pac.segment7), 'DD-MON-YYYY HH:MI:SS AM')-TO_DATE (pac.segment6, 'DD-MON-YYYY HH:MI:SS AM')+1) >1
last line is giving me the error pls suggest a solution

Similar Messages

  • How to get the difference between two HashMaps

    i have two HashMaps
    HashMap first = new HashMap<Integer,Object>();
    HashMap second = new HashMap<Integer,Object>();
    How to get the difference between one and two and put the result in the third
    HashMap third = new HashMap<Integer,Object>();

    My bad, difference of course means removeAll():Map<Integer,Object> first = new HashMap<Integer,Object>();
    Map<Integer,Object> second = new HashMap<Integer,Object>();
    Map<Integer,Object> third = new HashMap<Integer, Object>(first);
    third.keySet().removeAll(second.keySet());No loops needed.

  • What is the Difference between these Two?

    Hi All,
    In Oracle University site i saw 2 Courses for Oracle Webcenter sites. Just i would like to know the difference between these two. Based on your input i can decide which one to take.
    *1. Oracle Webcenter Sites for Developers*
              http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=609&p_org_id=1001&lang=US&get_params=dc:D73886GC10,p_preview:N
    *2. Oracle Webcenter Sites 11g for Developers*
              http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=609&p_org_id=1001&lang=US&get_params=dc:D78300GC10,p_preview:N
    Is the 1st one is Fatwire and the 2nd one is Fatwire+Oracle latest implmentation ? Is my understanding is right?
    regards
    Sri

    It's the same lens, just different sellers.  The higher one is the MSRP, or close to it.  But since they use this lens in a kit it goes for less.  I have no idea who Celltime Inc is, but it's fullfilled by Amazon, so I'd feel reasonably safe.  Just look into their return policy.
    With the recent release of the 6D and somewhat recent 5d3, the market is flooded with these lenses from kits; I wouldn't pay more than 800 something for it.  Getting it through Amazon is a bonus over eBay.  If the seller checks out I'd go for it.
    Edit: DH beat me to it. 

  • What is the difference between these two sticks of RAM?

    I am upgrading my Macbook 2.2 GHz Intel Core 2 duo from 2GB of ram to 4GB
    What is the difference between these two kits?
    4GB Kit (2 x 2GB) 200 Pin DDR2-667 PC2-5300 256x64 CL5 1.8V SODIMM ($102.00)
    4GB Kit (2 x 2GB) eRam 200 Pin DDR2-667 PC2-5300 CL5 1.8V SODIMM ($88.00)

    Probably nothing of any consequence. Some places can just negotiate better deals with suppliers. Or one of a million other factors that can affect price is in play here.
    When buying RAM, I generally find it's better to pay a little extra to get a brand that's known for quality. I usually stick to Crucial myself. If you look around, you can probably find some real steals out there, but I don't know... With stories of people who literally go dumpster diving, salvaging stuff that was slated for disposal, then turning around and selling it... I prefer not to take chances. If you are, by all means, go for the cheaper one.

  • Whats the difference between these two queries ? - for tuning purpose

    Whats the difference between these two queries ?
    I have huge amount of data for each table. its takeing such a long time (>5-6hrs).
    here whice one is fast / do we have any other option there apart from listed here....
    QUERY 1: 
      SELECT  --<< USING INDEX >>
          field1, field2, field3, sum( case when field4 in (1,2) then 1 when field4 in (3,4) then -1 else 0 end)
        FROM
          tab1 inner join tab2 on condition1 inner join tab3 on condition2 inner join tab4 on conditon3
        WHERE
         condition4..10 and
        GROUP BY
          field1, field2,field3
        HAVING
          sum( case when field4 in (1,2) then 1 when field4 in (3,4) then -1 else 0 end) <> 0;
    QUERY 2:
       SELECT  --<< USING INDEX >>
          field1, field2, field3, sum( decode(field4, 1, 1, 2, 1, 3, -1, 4, -1 ,0))
        FROM
          tab1, tab2, tab3, tab4
        WHERE
         condition1 and
         condition2 and
         condition3 and
         condition4..10
        GROUP BY
          field1, field2,field3
        HAVING
          sum( decode(field4, 1, 1, 2, 1, 3, -1, 4, -1 ,0)) <> 0;
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    My feeling here is that simply changing join syntax and case vs decode issues is not going to give any significant improvement in performance, and as Tubby points out, there is not a lot to go on. I think you are going to have to investigate things along the line of parallel query and index vs full table scans as well any number of performance tuning methods before you will see any significant gains. I would start with the Performance Manual as a start and then follow that up with the hard yards of query plans and stats.
    Alternatively, you could just set the gofast parameter to TRUE and everything will be all right.
    Andre

  • What is the difference between these two reports MC.1 and MB5L

    Hi
    what is the difference between these two reports MC.1 and MB5L?
    what is the Purpose of each report?
    Material ledger is activated for this plant, we found some amount difference between these two reports, my client accounting department used to compare these two reports while year end/month end closing
    Thanks
    Raju

    MC.1 will give you the report for plant analysis as per plant .
    MB5L report will give you list of stock value as per G/L account wise.

  • What is the difference between these two portalapps folders on the Server?

    Hello,
    On the Server there are two portalapps folder:
    1. Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\portalapps
    2. Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps
    Can someone please explain me what is the difference between these two portalapps folders and under which case will I turn to which folder?

    Hi Roy,
    The one at this location
    Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\portalapps
    has all the files from the WEB-INF folder i.e. these are the non-web resources and cannot be accessed via HTTP(S) examples would be imgaes, CSS etc that you want only your application to access
    those under
    Under: C:\usr\sap\JXX\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps
    they have all the .JAR files, portalapp.xml, config properties etc. these are web resources and can be accessed via HTTP(S)
    Hope this is of help.
    Akhilesh

  • What is the difference between these two commands?

    What is the difference between these two commands?
    DROP TABLESPACE users INCLUDING CONTENTS;
    DROP TABLESPACE users INCLUDING CONTENTS AND DATAFILES;
    --------No.202

    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9004.htm#i2133717

  • What's the difference between these two networks?

    Have searched a lot but can not find a clear answer to the difference between these two networks.
    (I'm using these as examples only)
    Using Airport utility
    * sometimes theres a dotted line "......"
    *And sometimes there's a solid line like a " } "
    I chose these as an example because ours is just like the first example above.
    However sometimes our presents similar to the above example only with two devices, not three.

    Dotted line is wireless.. Solid line is ethernet..
    Normally all ethernet should show as your lower picture since all are directly wired..
    Wireless should show which Airport is the main base and which extend using wireless.
    But it is 50% science and 80% voodoo (voodoo cannot count even!!)

  • How to get the difference between two columns in a column group

    Hi All,
    My first time here and really new to programming. I would like to get the difference between 2 columns that are inside 
    a column group.
    Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
                                PeriodNumber          
    Account                    1                            2     
    1) Cash                10,000                15,000
    2) Receivables      12,000                11,500
    3) Equipment          5,000                  5,500
    Total Assets          27,000                32,000

    Hi yabgestopa,
    From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
    Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
    Dim Shared Num1 As Integer
    Dim shared Num2 As Integer
    Public Function GetAmount(Amount as Integer, Type as String)
    If Type = "1" Then
    Num1=Amount
    Else
    Num2=Amount
    End If
    Return Amount
    End Function
    Public Function GetDif()
    Return Num1-Num2
    End function
    Right-click the second column to insert a third column with Outside Group-Right.
    Then use the expressions below in the matrix.
    =Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
    =code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
    =Code.GetDif()
    The report looks like below.
    If you have any questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • What is the difference between these two instant ink printers?

    Looking to get one of the HP instant ink printers from Best Buy. Either the Envy 4500 or the Envy 5530. There is a $20 diference and I did a side-by-side comparison of them on the Best Buy site, but the only difference I can notice is the 5530 seems to have more memory than the 4500 (128MB vs 32MB).
    Print speeds and resolutions seem to be the same. The cheaper one (4500) also seems to be able to do two-sided printing & reduction/enlargement (which I would have thought to be on the more expensive mode). So are there any other real differences between these two or have I pretty much covered them all?

    HI - great question, you identified a few of the differences.  Some additional differences are:
    4500 has a monochome display that is not touch enabled (you have to use scroll buttons on the side of the screen)
    5300 has a touch enabled color display
    Both printers can do duplexing (printing on both sides) and both have wireless.  
    We are excited about Instant Ink  and hope you enjoy the service & whichever printer you chose!  
    Although I am an HP employee, I am speaking for myself and not for HP

  • Would you happen to know the difference between these two fields from FI-GL

    Hi,
    Would you happen to know the differnce between these two field
    i. UMSOL from 0fi gl6 and DMSOL from 0fi_ gl_4
    ii. UMHAB from 0fi gl6 and DMHAB from 0fi_ gl_4
    iii.In a test case on a system, where I was looking for the same values in comparison, I am getting inconsistent data.
    which key figures in 0fi gl6  are equivalent to which in 0fi_ gl_4
    Any hints
    Thnx
    Edited by: AmandaBaah on Jul 29, 2009 2:47 AM

    Hi Amanda,
        They are both very different datasources. 0FI_GL_6 is the General Ledger: Transaction Figures which fetched data from the GLT0 table while 0FI_GL_4 fetched data from the BSEG and BKPF tables and fetched the line items from the general ledger.
    You can refer the following links for more info
    [0FI_GL_6|http://help.sap.com/erp2005_ehp_04/helpdata/EN/0a/558cabb2e19a4db3097b81bba4fd0e/content.htm]
    [0FI_GL_4|http://help.sap.com/saphelp_bw33/helpdata/en/af/16533bbb15b762e10000000a114084/content.htm]
    Regards.

  • How to get the difference between two date

    Hello,
    I want to know how to write a code the tell me the difference between two date, I am using
    oracle.jbo.domain.Date
    i have a rent date and return date so my code is
    Date rent=(Date)nr.getAttrbute("RentDate"),ret=(Date)nr.getAttrbute("ReturnDate");
    is there a way to know the difference in days between those two dates ?
    Thanks

    hi,
    try this.....
    DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
    Date date = (Date)formatter.parse(dateStr); //// dateStr <- from date value (that is string value)
    Date dateto = (Date)formatter.parse(datetostr); //// datetostr <- to date value (to date getting from as a string)
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    Calendar calto = Calendar.getInstance();
    calto.setTime(dateto);
    fromDate = cal.get(Calendar.DATE) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
    toDate = calto.get(Calendar.DATE) + "/" + (calto.get(Calendar.MONTH) + 1) + "/" + calto.get(Calendar.YEAR);
    // System.out.println("from Date : " + fromDate);
    if ((fromDate != null && toDate != null) && (date.compareTo(dateto) > -1) ) {                  
    fc.addMessage("VacationQueryComponent", new FacesMessage(FacesMessage.SEVERITY_ERROR, "From Date cannot be lower than To Date", "From Date cannot be lower than To Date"));
    fc.renderResponse();
    thks.

  • How to get the difference between two BufferedImages?

    All the BufferedImage which is grabbed from AWT may be same each other,
    i only want to get the different part of two continuous BufferedImages and send ti over internet.
    I have compared two BufferedImages by RGB (int[]), but this process wastes 400~500ms,it's terrible,:)
    who has any good idea about this?
    thanks
    Best Wishes
    mauvespan

    thanks ! cary ,
    I have a list contained some BufferedImages gotten from AWT component,and then these images
    will be transfered to client and displayed in Internet explore ,actually there are only some difference
    between two continuous BufferedImages,i don't want to transfer the WHOLE image to client,SO i
    want to handler every image before sending to client , at last, the different part will only be sent to client.
    All these ideas will be contained this method:
    * Compare the specified two BufferedImages and return the different part between them.
    * @param ref the specified first image
    * @param gen the specified sencond image
    * @return the different part between the specified two images.
    public static void BufferedImage compareBufferedImage(BufferedImage ref,BufferedImage gen){
    to finish this method ,do you have any good ideas?or sample code?
    thanks
    Best wishes
    mauvespan

  • What's the difference between these two backup systems?

    When I bought my Macbook Pro I bought a Seagate external HD that used Bounceback Express as its backup application. But now my Mac defaults to Time Machine. What's the difference between the two applications? When I use Time Machine to back up my hard drive to the Seagate external, is it doing the same thing as Bounceback Express used to?

    In analog terms, to explain YCbCr use the example of the COMPONENT output from your DVD player. It use 3 separate cables (Y = Luminance = Green Cable), (Y-B = Blue Color Diff = BLUE Cable) and (Y-R = Red Color Diff = RED Cable). In the analog world, RGB is actually RGBHV (5-wire) and is adaptable to 15-pin VGA with a simple passive adapter. Many people will mistakenly refer to Analog Component video as RGB, since the cables are Red, Green and Blue.
    So, since all that mumbo jumbo means essentially the same, this appears to be the digital "equivalent" of what is known as Component Video in the Analog world... What I said about RGBHV does not apply to the 10-bit color, but thought I'd mention it anyway.
    -BChil

Maybe you are looking for

  • Error while running adcfgclone on apps tier

    I am getting the following error while running adcfgclone on the apps tier... OS: RHEL 5.5 64bit Oracle 10.2.0.3 EBS R12.0.4 Multinode DB Tier and APPS Tier on different nodes. RC-50004: Fatal: Error occurred in ApplyAppsTier: StackTrace - java.lang.

  • How to deploy manually the Smart Ticket1.1 from the JavaBluePrints?

    Hi, I will like to know that how to deploy the Smart Ticket1.1 which from the JavaBluePrints with the use of J2EE1.4 SDK? I had deployed the .ear file under the Enterprise Applcation. However, the problem is how to establish the database connection o

  • Simple stroke FROM outline stroke

    Hi, of course, I know how to create outlines from a stroke. But for a specific project, I need to be able to do the exact opposite. I have lots of vector illustrations like the one attached, that are made of outline strokes, and I need to convert the

  • I can't get my new MuVo Fm to turn on without being plugged in, HE

    I recently purchased a MuVo FM, I'm pretty sure I've oaded everything correctly. I've put music on it & everything works fine, as long as it's plugged in. Once I unplug it, it won't turn on! Have I done something wrong? Any help would be greatly appr

  • MuVo-TX-SE and Win98SE: driv

    Hi, I'm planning to buy MuVo-TX-SE, and as I have Win98SE as OS, I need a driver. But I cannot find a driver for MuVo-TX-SE, only for MuVo-TX. At Creative's web page the Minimum System Requirements for MuVo-TX-SE is Win98SE. So can I use the driver o