How to Correct this Select Statement...?

hi all
i wrote a select as follows
select datediff('HH',to_date(job_start,'hh24:mi:ss'),to_date('15:29:59','hh24:MI:ss')) from shift
requirement is to calculate the hours used in a shift, the job_start column is date type and having value '23/08/2007 07:00:00' , and the second one is the shift end time. so it should give 8.5 hrs as the result. but it is throwing error ORA--1858 non-numeric char found where a numeric expected. datediff function is taken from Ask Tom discussion forums.
any idea...?
regards
Kris

I think i cant, this is to be done for every day...so
is there any way i can set the time of the current
date to '15:29:59'..?
SQL> ed
Wrote file afiedt.buf
  1  with t as (select to_date('23/08/2007 08:30:00','dd/mm/yyyy hh24:mi:ss') as start_time from dual)
  2  -- end of test data
  3  select (to_date(to_char(sysdate,'dd/mm/yyyy')||'  15:29:59','dd/mm/yyyy hh24:mi:ss')-start_time)*24 as hrs
  4* from t
SQL> /
       HRS
6.99972222
SQL>

Similar Messages

  • How to optimize this select statement  its a simple select....

    how to optimize this select statement  as the records in earlier table is abt i million
    and this simplet select statement is not executing and taking lot of time
      SELECT  guid  
                    stcts      
      INTO table gt_corcts
      FROM   corcts
      FOR all entries in gt_mege
      WHERE  /sapsll/corcts~stcts = gt_mege-ctsex
      and /sapsll/corcts~guid_pobj = gt_Sagmeld-guid_pobj.
    regards
    Arora

    Hi Arora,
    Using Package size is very simple and you can avoid the time out and as well as the problem because of memory.  Some time if you have too many records in the internal table, then you will get a short dump called TSV_TNEW_PAGE_ALLOC_FAILED.
    Below is the sample code.
    DATA p_size = 50000
    SELECT field1 field2 field3
       INTO TABLE itab1 PACKAGE SIZE p_size
       FROM dtab
       WHERE <condition>
    Other logic or process on the internal table itab1
    FREE itab1.
    ENDSELECT.
    Here the only problem is you have to put the ENDSELECT.
    How it works
    In the first select it will select 50000 records ( or the p_size you gave).  That will be in the internal table itab1.
    In the second select it will clear the 50000 records already there and append next 50000 records from the database table.
    So care should be taken to do all the logic or process with in select and endselect.
    Some ABAP standards may not allow you to use select-endselect.  But this is the best way to handle huge data without short dumps and memory related problems. 
    I am using this approach.  My data is much more huge than yours.  At an average of atleast 5 millions records per select.
    Good luck and hope this help you.
    Regards,
    Kasthuri Rangan Srinivasan

  • How to convert this select statement into update

    Hai All
    I have two table Namely Daily_attend , Train_mast
    Daily_attend Consist Of fields are Train_mast consist Of fields are
    Name varchar Train no var
    Empcode Num T_date date
    Intime Date Train_name var
    Outtime date Late_hrs var
    IND_IN Number
    IDE_OUT Number
    Attend_date date
    I need to update IDE_IN In Daily_attend table Depend upon late_hrs in the Train_mast table
    I have got Through in select statement This is my select statement
    select to_number(TO_DATE(TO_CHAR(Intime,'DD-MON-YYYY')||' '||
    TO_CHAR(0815,'0000'),'DD-MON-YYYY HH24:MI')+late_hrs/(24*60)-intime
    ) * 24*60 from dail_Att,train_mast;
    How can i convert it to update
    Any help is highly appricateable
    Thanks In Advance
    Regards
    Srikkanth.M

    Srikkanth,
    Try this code. And 1 more thing, i can't see any WHERE condition to join between the 2 tables DAIL_ATT, TRAIN_MAST.
    UPDATE DAIL_ATT A SET A.IDE_IN = (SELECT TO_NUMBER(TO_DATE(TO_CHAR(INTIME, 'DD-MON-YYYY')|| ' ' || TO_CHAR(0815, '0000'), 'DD-MON-YYYY HH24:MI') + LATE_HRS / (24 * 60) - INTIME) * 24 * 60 FROM TRAIN_MAST B WHERE <condition>);Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • How to make this select statement faster?

    this statement is really taking long time to process.
    in bseg table as vbeln is not primary key or seconday key, i guess thz the reason it is taking so much time ,,,
    can anyone help me to sort this out... ??
    any fun mod to get the data of bseg cluster table by giving vbeln?/
    or any other conditions to reduce the processing time?
    clear t_vbrkvbrp.
    sort t_vbrkvbrp by vbeln.
    loop at t_vbrkvbrp.
    at new vbeln.
    select bukrs belnr vbeln
           from bseg
           into corresponding fields of table t_temp
           where bukrs = t_vbrkvbrp-bukrs
            and vbeln = t_vbrkvbrp-vbeln.
    endat.
    endloop.
    SELECT bukrs belnr buzid koart shkzg dmbtr vbeln hkont kunnr werks
           FROM bseg
           INTO TABLE t_bseg
           for all entries in t_temp
           WHERE hkont IN s_hkont
           AND bukrs = t_temp-bukrs
           AND belnr = t_temp-belnr
           AND buzid = ' '
           AND koart = 'S'
           AND shkzg = 'H'.
    i need to get the g/l account number for the above condition type so i have to use bseg table
    Message was edited by:
            shahid mohammed syed

    Shahid,
    Usually BSEG SELECTs are slow as it is a Clu8ster table. More over you are not passing the PKeys in the WHERE condition. That's alcso one reason for slow retrieval. You can also use the table BSIS (Accounting: Secondary Index for G/L Accounts) for the G/L accounts. But first of all, I suggest you cnange your where condition as below:
    SELECT bukrs belnr buzid koart shkzg dmbtr vbeln hkont kunnr werks
    FROM bseg
    INTO TABLE t_bseg
    for all entries in t_temp
    WHERE  bukrs = t_temp-bukrs
    AND belnr = t_temp-belnr
    AND buzid = ' '
    AND koart = 'S'
    AND shkzg = 'H'
    <b>AND hkont IN s_hkont.</b>
    Not much diff. I just re-ordered the condition based on the order of BSEG fields... Lemme know if it helps.
    Regards,
    Karthik
    Message was edited by:
            Karthik

  • I'm having problems (1)selecting onscreen text, (2) having problems resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    I'm having problems (1) selecting onscreen text, (2) resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    1) This is because of software version 1.1. See this
    thread for some options as to how to go back to 1.0,
    which will correct the problem...
    http://discussions.apple.com/thread.jspa?threadID=3754
    59&tstart=0
    2) This tends to happen after videos. Give the iPod a
    minute or two to readjust. It should now be more
    accurate.
    3) This?
    iPod shows a folder icon with exclamation
    point
    4) Restore the iPod
    5) Try these...
    iPod Only Shows An Apple Logo and Will Not Start
    Up
    iPod Only Shows An Apple Logo
    I think 3,4, and 5 are related. Try the options I
    posted for each one.
    btabz
    I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again

  • In how many ways we can filter this select statement to improve performance

    Hi Experts,
    This select statement taking 2.5 hrs in production, Can we filter the where condition, to improve the performance.Plz suggest with coding ASAP.
    select * from dfkkop into  table t_dfkkop
               where   vtref   like 'EPC%'        and
                   ( ( augbd      =  '00000000'   and
                       xragl      = 'X' )
                               or
                     ( augbd between w_clrfr and  w_clrto )  )  and
                       augrd      ne '03'         and
                       zwage_type in s_wtype .
    Regards,
    Sam.

    if it really takes 2.5 hours, try the followingtry to run the SQL trace and
    select *
              into table t_dfkkop
              from dfkkop
              where vtref like 'EPC%'
              and augbd = '00000000' and xragl
             and augrd ne '03'
             and zwage_type in s_wtype .
    select *
              appending table t_dfkkop
              from dfkkop
              where vtref like 'EPC%'
             and augbd between w_clrfr and w_clrto 
             and augrd ne '03'
             and zwage_type in s_wtype .
    Do a DESCRIBE TABLE after the first SELECT and after the second,
    or run an SQL Trace.
    What is time needed for both parts, how many records come back, which index is used.
    Siegfried

  • I am trying to upgrade from Tiger to Snow Leopard.  When I insert the disk and install starts, it states "This disk is used for Time Machine backups" and Mac OSX can't be installed.  Does anyone know how to correct this (since Tiger doesn't have Time Mach

    I am trying to upgrade from Tiger to Snow Leopard.  When I insert the disk and install starts, it states "This disk is used for Time Machine backups" and Mac OSX can't be installed.  Does anyone know how to correct this (since Tiger doesn't have Time Machine)?

    http://support.apple.com/kb/TS2986

  • How to use bind variable in this select statement

    Hi,
    I have created this procedure where table name and fieldname is variable as they vary, therefore i passed them as parameter. This procedure will trim leading (.) if first five char is '.THE''. The procedure performs the required task. I want to make select statement with bind variable is there any possibility to use a bind variable in this select statement.
    the procedure is given below:
    create or replace procedure test(tablename in varchar2, fieldname IN varchar2)
    authid current_user
    is
    type poicurtype is ref cursor;
    poi_cur poicurtype;
    sqlst varchar2(250);
    THEVALUE NUMBER;
    begin
         sqlst:='SELECT EMPNO FROM '||TABLENAME||' WHERE SUBSTR('||FIELDNAME||',1,5)=''.THE ''';
         DBMS_OUTPUT.PUT_LINE(SQLST);
    OPEN POI_CUR FOR SQLST ;
    LOOP
         FETCH POI_CUR INTO THEVALUE;
              EXIT WHEN POI_CUR%NOTFOUND;
              DBMS_OUTPUT.PUT_LINE(THEVALUE);
              SQLST:='UPDATE '||TABLENAME|| ' SET '||FIELDNAME||'=LTRIM('||FIELDNAME||',''.'')';
              SQLST:=SQLST|| ' WHERE EMPNO=:X';
              DBMS_OUTPUT.PUT_LINE(SQLST);
                   EXECUTE IMMEDIATE SQLST USING THEVALUE;
    END LOOP;
    COMMIT;
    END TEST;
    Best Regards,

    So you want to amend each row individually? Is there some reason you're trying to make this procedure run as slow as possible?
    create or replace procedure test (tablename in varchar2, fieldname in varchar2)
    authid current_user
    is
       sqlst      varchar2 (250);
       thevalue   number := 1234;
    begin
       sqlst := 'update ' || tablename || ' set ' || fieldname || '= ltrim(' || fieldname || ',''.'')  where substr(' || fieldname
          || ',1,5) = ''.THE ''';
       dbms_output.put_line (sqlst);
       execute immediate sqlst;
    end test;will update every row that satisfies the criteria in a single statement. If there are 10 rows that start with '.THE ' then it will update 10 rows.

  • How to execute a SELECT statement  in java??

    Hello !!
    In my java program , i need to delete a record of number X, so
    i accept the number X from the keyboard
    Then before deleting it
    i want the program to show me the name, age of the record which has the number X
    How to do this

    hello kylas
    actually i didnt get why this program example?? wats
    its executing ??? Look at reply #3 in your other thread:
    http://forum.java.sun.com/thread.jspa?threadID=713289&messageID=4126346
    Notice the similarity? You've now asked "How to delete a record in Java" and "how to execute a select statement in java". You may have noticed that, aside from the SQL and the call to execute and executeUpdate (for delete) it's the same code. This is because you don't so much do these things in Java, you do them in SQL. The Java code simply asks the Driver to execute whatever SQL you write. So, I really hope your next post isn't "how do I execute an UPDATE statement in Java".
    Good Luck
    Lee

  • I have two email accounts, an aol account and a corp. outlook account.  When I enable the WI-FI connection I do not receive aol emails, yet I receive the outlook emails on my iphone4.  Any ideas how to correct this?

    When I enable WI-FI on my iphone4 and connect  to my network I do not receive emails from my AOL account, however, I receive emails from my corporate outlook exchange account.  When WI-FI is disabled I receive emails from each account.  Any ideas how to correct this?  Thanks in advance.

    Try disabling graphics hardware acceleration. Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches.
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    *Click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    *In the Firefox options window click the ''Advanced'' tab, then select "General".
    *In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    *Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    * [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    * [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    Did this fix your problems? Please report back soon.

  • I am using system 10.7.3 and my I photo 9.2.3 keeps crashing upon start up.  Does anyone know how to correct this without losing my photos?

    I am using system 10.7.3 and my I photo 9.2.3 keeps crashing upon start up.  Does anyone know how to correct this without losing my photos?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Console in the page that opens.
    Step 1
    Enter the name of the crashed application or process in the Filter text field. Post the messages from the time of the last crash, if any — the text, please, not a screenshot.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.
    Step 2
    Still in the Console window, look under User Diagnostic Reports for crash reports related to the process. The report name starts with the name of the crashed process, and ends with ".crash". Select the most recent report and post the contents — again, the text, not a screenshot. For privacy’s sake, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.) Please don’t post shutdownStall or hang logs — they're very long and not helpful.

  • After 10.8.4 Update, I receive a series of capital A's in a box in some of the email signatures I receive. I can not figure out how to correct this.

    After 10.8.4 Update, I receive a series of capital A's in a box in some of the email signatures I receive. I can not figure out how to correct this.

    Back up all data.
    Launch the Font Book application and validate all fonts. You must select the fonts in order to validate them. See the built-in help and this support article for instructions. If Font Book finds any issues, resolve them, then boot in safe mode to rebuild the font caches. Boot again as usual and test.
    Note: If FileVault is enabled under OS X 10.7 or later, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode. In that case, ask for instructions.

  • My iMac is connected to a Brother printer. I have Snow Leopard 10.7.3 As of yesterday, when I try to print a PDF it prints as a blank black page. Does anyone know how to correct this so that the PDF will print as I see it on screen?

    My iMac is connected to a Brother printer. I have Snow Leopard 10.7.3 As of yesterday, when I try to print a PDF it prints as a blank black page. Does anyone know how to correct this so that the PDF will print as I see it on screen?

    If you are running Mac OS X 10.7.3 then you have Lion installed, not Snow Leopard. It's probably not important to this discussion, but something you should be aware of.
    What application are you printing the PDF files from? Have you tried opening the PDF file using the Preview application that can be found in the Applications folder? Does the issue still occur? Have you tried other PDF files from a different source?
    Another poster in the following discussion thread reported that this method resolved their black blank PDF issue when viewing (and presumably printing) PDF files from Safari.
    https://discussions.apple.com/thread/3890509?start=0&tstart=0
    This solved my question by mcbuffy  on Apr 20, 2012 11:29 AM 
    There's a solution if you want to see the PDF inside Safari's window :
    Go to the folder : Your Hard Drive / Library / Internet Plug-ins.
    If you see a file with PDF in its name drag it to the trash.
    Quit and restart Safari to test with a PDF.
    If it works you can empty the trash.

  • In iTunes 11, when I click on "Artists," several "Album Artists" show up in list.  How to correct this?  Thanks!

    Hello,
    When I click on "Artists," a number of "Album Artists" are showing up in the list.  How to correct this?  Thank you!

    Is that the Bookmarks Menu button ?
    *https://support.mozilla.org/kb/how-do-i-use-bookmarks
    *https://support.mozilla.org/kb/common-questions-after-updating-firefox
    *http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox
    *https://support.mozilla.org/kb/Sorting+bookmarks

  • The volume keys on my Logitech K760 wireless keyboard do not work with my 2.3 GHz, Intel Core i5 Mac mini which runs Mac OS X 10.7.4. Anyone know how to correct this without having to re-code firmware?

    My first post to the Apple Support Community so it looks like all I wanted to know is covered in the title. The research I have done led me to solutions that I am not comfortable trying for fear of irreparably damaging my keyboard and/or Mac mini. Does anyone have a simpler solution? Please? Hellooooo?
    Just in case the title is too long to show, I have re-pasted here:
    The volume keys on my Logitech K760 wireless keyboard do not work with my 2.3 GHz, Intel Core i5 Mac mini which runs Mac OS X 10.7.4. Anyone know how to correct this without having to re-code firmware?

    BDAqua wrote:
    Hello & welcome to the Forums!
    I think Spark cured this for another person and the same problem...
    http://www.shadowlab.org/Software/spark.php
    http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele
    http://doublecommand.sourceforge.net/
    Thank you for the response. Unfortunately, I could not figure out how to work the above applications. I thought that i had managed to assign the appropriate function keys in Spark to their volume counterparts, but it had no effect. Below is a screen shot. Do you see anything amiss?

Maybe you are looking for