I want to convert number to hours in oracle 10 like this.

Dear All
Some can help me
I want to convert below MS-SQL query in oracle 10g. please help me.
for eg:
Select numasdate,
Cast(numasdate / 60 as Varchar) + ' hours ' +
Cast(numasdate % 60 as Varchar) + ' minutes'
as [TotalHoursAndMinutes]
From
#SampleTable
Output:
9436 157 hours 16 minutes
537 8 hours 57 minutes
9323 155 hours 23 minutes
12525 208 hours 45 minutes
Edited by: Parwez on Jan 1, 2013 5:33 AM

I want to convert number to hours in oracle 10g like this.
537 8 hours 57 minutes
9436 157 hours 16 minutes
12525 208 hours 45 minutesTry this...
Ranit>> with xx as(
  2      SELECT 537 num from dual UNION ALL
  3       SELECT 9436 num from dual UNION ALL
  4       SELECT 12525 num from dual
  5  )
  6  select
  7       num,
  8       FLOOR(num/60)||' hrs' as "hrs",
  9       MOD(num,60)||' minutes' as "minutes",
10       FLOOR(num/60)||' hrs  '||MOD(num,60)||' minutes' as "Hours.Mins"
11  from xx;
       NUM hrs                                          minutes                                          Hours.Mins                                                                                                        
       537 8 hrs                                        57 minutes                                       8 hrs  57 minutes                                                                                                 
      9436 157 hrs                                      16 minutes                                       157 hrs  16 minutes                                                                                               
     12525 208 hrs                                      45 minutes                                       208 hrs  45 minutes                                                                                                Edited by: ranit B on Jan 1, 2013 6:51 PM
--- Hey John... I just did it and saw your hint now !!!

Similar Messages

  • Converting Number to Date in Oracle sql

    I have some values in field1 like
    20110820,
    20110821,
    20110822
    which is a number datatype and
    which is something like yyyymmdd.
    I want to convert it to date format as 'dd/mm/yyyy'.
    I have to use in select query something like if (A.field1=0, 01/01/2000, A.field1).
    How can i achieve this ?

    to_Date(substr(date1,7,2)||'/'||substr(date1,5,2)||'/'||substr(date1,1,4),'dd/mm/yyyy')

  • When I go into pdf file it only gives me the option to convert into pdf when it's already a pdf. I want to convert it into word and I've purchase this a few months ago now I need help

    I Need help in converting a pdf into word. I've purchased it a few months ago and now for the first time I tried to use word and I can't it only gives me the option to convert it into a pdf when it is already a pdf! Urgent help please

    Not sure what you mean by "tried to use Word". ExportPDF doesn't change what Word can do. Can you explain what you try and what happens in more detail?

  • Want External Phone Number Mask to say "Unknown Caller" Is this Possible?

    When a user dials an external # is it possible to have it show on Caller ID as "Unknown Caller"?
    I have deleted the # that is currently in the External Phone Number Mask, and left it blank, but the Coporate# now shows when he dials out.
    This is something that only needs to be setup for 1 user, not the entire company.

    There will always be some number/name displayed. If you do not put in a number in the outside mask, the number/name associated with the smart trunk will be displayed.
    You might talk to your local phone company and see if they can restrict the numbers or a single phone number. If they can do that on even one number, you can put it into the mask for all of your phones.
    Two other problems you might have with this. One, a lot of people (I do) block calls from phones that do not display a phone numbers.
    Another problem you are going to run into is when someone calls "911" by accident. The Police/fire will try to call back to the number for the smart trunk. And since most often is not on a phone. They will send cars or trucks to the address listed for those smart trunks. Usually the billing address for your company.

  • Everytime I click on my firefox tab or shortcut, up comes a full bing! page. I want my full firefox page. It's been like this since my daughter used the computer 2 days ago. Help. Thx

    I don't know any more.

    Hi one1ron,
    Are you saying that your home page has been changed to Bing? You should take a look at the Knowledge Base article [[How to set the home page]] for steps on changing it back. I would suggest using the option to restore to default first, the if that works you can choose any site you like.
    If your default search has been changed as well, you may want to change that back. The [[Search bar]] article will show you how that can be done as well.
    Hopefully this helps!

  • I had a problem with my mouse double(multiple) clicking when I didn't want it to, now pressing enter in a window like this will close the current window and open one of my Taboo sites, and the cursor keys don't work.

    This happens in any text entry window, but there is no problem with Wordpad or Word or other apps, just in Firefox. It's like the keyboard mapping has gotten fouled up in Firefox, but I can't find where I might check what is going on.

    You may have '''Switched ON Caret Browsing'''. press '''F7 (on Mac: fn + F7)''' to toggle '''Caret Browsing ON/OFF'''
    * click '''Firefox''' button and click '''Options''' -> Advanced -> General -> remove
    Checkmark from '''Always use the cursor keys to navigate within pages'''
    * http://kb.mozillazine.org/Scrolling_with_arrow_keys_no_longer_works
    * http://kb.mozillazine.org/Accessibility_features_of_Firefox
    Check and tell if its working.

  • Convert a Number to time in Oracle

    Hi,
    In a oracle database table i have a colum that gives the value from 0 to 2359. I want to convert Number to time in Oracle. Any i dea on the query for this.
    I have tried
    SELECT TO_CHAR('2342','HH:MI') "Time"
    FROM dual;
    but it is not functioning.
    Thanks

    The Number that i want to convert to Time is of the
    columns of the same table and depending on its value,
    i want to display it as Time.
    Thanks,Well it sounds like you certainly have no clue what you are doing whatsoever. I predict a bright future for you.
    Here's some advice. If the column should have a date or time in it then use a date or time type column. If you are creating a variable data type column then ASAP get a book on SQL before you fuck things up worse then you have.
    There is no great mystery here. There is the right way (as suggested by WorkForFood) and there is the wrong way (whatever you are doing). So do what WorkForFood told you or just go away because nobody cares to help make a disaster.

  • Converting number in words

    Hi,
    I want to convert number in words and get the output through a query.
    For example :if the value in row is 1311 then I want the query to return it like one thousand three hundreds and eleven.
    Any help is highly appreciated.
    Cheers

    It could be better indeed, scope is larger, but problem with 0 still exists.
    SQL> select to_char(to_date(0,'J'), 'JSP') as converted_form from dual;
    select to_char(to_date(0,'J'), 'JSP') as converted_form from dual
    ERROR at line 1:
    ORA-01854: julian date must be between 1 and 5373484
    SQL> Better to build function as showed by Tom Kyte in the link given earlier.
    Nicolas.

  • FM to find the difference in the number of hours

    hi all,
    is there any function module to find out the difference between two time stamps on two different dates. say if an activity starts on 09/05/2007 at 11:23:24 and ends on 09/08/2008 at 14:24:26. it needs to find the number of hours between the two. for this case it should be:
    75:01:02 hours:mins:secs.
    or a FM which works in a way similar to the above functionality.

    Hi,
    Use FM SD_CALC_DURATION_FROM_DATETIME
    but this will not give the seconds difference
    Regards
    Shiva

  • How to convert number to string in java

    hi how can i convert number to string in java
    something like
    public void Discription(Number ownerName){
    String.valueOf(ownerName);Edited by: adf009 on 2013/04/08 7:14 PM

    Yet another way of doing it is: ownerName.toString().
    If you are working in and IDE such as Netbeans or Eclipse, type a period after the object name. Wait a second or so. Eclipse/Netbeans Intellisense will show you a list of functions that object provides that you can choose from. toString() is one of them.

  • Convert rows to Columns in Oracle

    Hi,
    The table like
    Trx         Date
    PO121 23/11/2008
    PO122 24/11/2008
    PO123 25/11/2008
    I want to convert all the rows to columns like the below table
    PO121    23/11/2008    PO122    24/11/2008       PO123     25/11/2008
    Is it possible in Oracle ?

    Like this
    SQL> WITH T
      2  AS
      3  (
      4     SELECT 'PO121 23/11/2008' VAL FROM DUAL
      5     UNION ALL
      6     SELECT 'PO122 24/11/2008' FROM DUAL
      7     UNION ALL
      8     SELECT 'PO123 25/11/2008' FROM DUAL
      9  )
    10  SELECT MAX(DECODE(RNO,1,VAL)) VAL1, MAX(DECODE(RNO,2,VAL)) VAL2, MAX(DECODE(RNO,3,VAL)) VAL3
    11    FROM (SELECT ROW_NUMBER() OVER(ORDER BY VAL) RNO, VAL
    12       FROM T)
    13  /
    VAL1             VAL2             VAL3
    PO121 23/11/2008 PO122 24/11/2008 PO123 25/11/2008But beware the number of column must be known. without that you cant do it in a static SQL.
    Edited by: Karthick_Arp on Nov 10, 2008 1:41 AM

  • Hi want to convert a number in crore, e.g. 10000000 to 1.00 Can anybody help on this?

    Hi All,
    I want to convert a number in crore format.
    My basic problem is, I am using a custome format:
    #,##0.00,,,%;
    Here main task is done by ,,,%.
    Each comma (,) is dividing a number by 1000. Thus three commas are dividing a number by 10^9 digits.
    But I need number in crore (i.e. 10^7), Thus we have used this percent sign (%).
    Here I can get required Value but appended percent (%) to it. I can temporary hide this using wrap text.
    But I need exact solution to convert a number in crore.
    Can anybody help me regarding the same.

    Hi Neha,
    You can use EPMScaleData function, in that give scaling factor as per your requirement.
    For more details you can go through following link
    How to use EPMScaleData in a fully dynamic report
    Regards,
    Shrikant

  • How to convert frames into hours:minutes:seconds?

    if I have some columns which contains the time value in frames, i.e. Content_Duration, program_duration etc.
    How can I convert those frames in hh:mm:ss?
    Is it possible to do it with a function do that so that I can re-use it?
    Thanks

    I am not quite sure where you get content_interval from?CONTENT_INTERVAL comes from the function call "numtodsinterval( content_duration / 1500, 'MINUTE' )" in the inline view.
    You might want to code it as "numtodsinterval( content_duration / 25, 'SECOND' )" to match the 25 frames/second standard you mentioned after I posted my reply.
    will it allow more than 99 hours? i.e. 154:57:40?Actually, it won't work for more than 23 hours, 59 minutes, 59 seconds. For larger numbers this technique requires a field for the number of days, like this.
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 29 12:41:38 2007
    create table t ( content_duration number );
    Table created.
    insert into t values ( 1500*60*99 /* = 99 hours */ );
    1 row created.
    commit;
    Commit complete.
    select
      lpad(extract(DAY    from content_interval),2,'0')||' '||
      lpad(extract(HOUR   from content_interval),2,'0')||':'||
      lpad(extract(MINUTE from content_interval),2,'0')||':'||
      lpad(extract(SECOND from content_interval),2,'0')
      as result
    from
      ( select numtodsinterval( content_duration / 25, 'SECOND' ) as content_interval
        from t
    RESULT
    04 03:00:00
    1 row selected.
    -- if you're going to show DAYS though, the following way is simpler
    select
      cast
      ( numtodsinterval( content_duration / 25, 'SECOND' ) as interval day(2) to second(0))
      as result
    from t ;
    RESULT
    +04 03:00:00
    1 row selected.If you really need output like 99:00:00 instead of +04 03:00:00 then take Volder's approach.
    Is it possible to do it as a function?Anything you can do with a SQL query you can probably do inside a function, but for a line of code like "cast ( numtodsinterval( ..." I personally wouldn't bother.
    Joe Fuda
    SQL Snippets

  • How do I convert time from hours and minutes to decimal time

    I am making a spread sheet a work for payroll. I need to make a formula that converts the time from hours and minutes to decimal time. Please help

    Hi Taryn,
    I can't see much from the photo, but I assume your formula is similar to the one I've used below:
    The same formula is used in F4 and F6, and both return the same result (shown in F4).
    F4 was left on "automatic" cell format, and the column widened to accomodate the repeating decimal to the point where Numbers would begin displaying zeros.
    F6 was formatted as shown in the Cell Inspector to show only two decimal places.
    Neither of these is an "exact" decimal, as it is not possible to use a decimal fraction to "exactly" represent 1/6 (or 10/60).
    The likely reasons for yours showing a whole number of hours is a difference between your formula and the one shown in the example here, or a difference in the number of decimal places set in the cell's format.
    Regards,
    Barry
    PS: To take a screen shot:
    Place the mouse pointer at the top left corner of the area you want to nclude in the shot.
    Press shift-command-4.
    Use the mouse to drag a selection rectangle contining the part of the screen you want to include.
    Release the mouse button. (You'll hear the sound of a camera shutter 'snapping' the picture.)
    The screen shot will be saved to your desktop with the name 'screen shot' followed by the date and time.
    The image may be posted to the discussion using the same steps you used to post the photo above.
    B.

  • Converting days into hours and adding this hour to the time

    Hi Gurus!
    I ahve  a query that outputs the total time between two periods in one column , total number of days between two periods  in onne column. I want to combine those together and show it in hours . For example if the time column shows 7:41(7 hours  and 41 minutes ) and teh days column shows 1 day , I want to combine those two columns and show as one column i.e 24 hours plus 7 hours and 41 minutes as a total of 31 hours and 41 minutes. I had written the follwwing code in the query that calculated the two seprately , can anyone please tell me how to go about converting this hour into time format and then adding the two to get it in total number of hours and minutes in my query.
    concatenate vttk-datbg vttk-uatbg into lv_start_time.
        concatenate vttk-daten vttk-uaten into lv_end_time.
        gv_ftstm = lv_end_time - lv_start_time.
        gv_total_time = gv_ftstm+8(6).
        if not ( vttk-datbg is initial
              or vttk-daten is initial ).
          gv_total_days = gv_ftstm+0(8).
        else.
          clear: gv_total_days.
        endif.
        if not p_bl_lns is initial.
          read table gt_vttk with key tknum = vttk-tknum.
          if sy-subrc <> 0.
            append vttk to gt_vttk .
          else.
            clear: vttk-distz,
                   vttk-gesztda,
                   vttk-fahztda,
                   vttk-warztda,
                   gv_total_days,
                   gv_total_time.
          endif.
        endif.
    The gv_total_days have been declared as type P lenght 6, outlenth 10 and decimal 02, and
    gv_time as VTTK-FAHZTDA.
    Thnaks

    Does this help ?
    CONVERT DATE par_date TIME par_time INTO
              TIME STAMP par_timestamp TIME ZONE par_time_zone.
    also use fm:  SD_DATETIME_DIFFERENCE
    01/01/2009
    12:00:00
    01/02/2010
    11:00:00
    output:                             365
                                 23
    365 * 24 = tine in Hrs + 23 hrs

Maybe you are looking for