Function in/out the SELECT

Hi, exists a different in performance with this 2 querys?
without the TRUNC in the query:
declare
l_id      number ;
l_id_tip  number := 156 ;
l_date    date := trunc(to_date('06/03/2007','dd/mm/yyyy')) ;
begin
  SELECT DISTINCT id
  INTO l_id
  FROM t1      
  WHERE id_tip = l_id_tip
     AND last_date <= l_date ;
end;
/with the TRUNC in the query:
declare
l_id      number ;
l_id_tip  number := 156 ;
begin
  SELECT DISTINCT id
  INTO l_id
  FROM t1      
  WHERE id_tip = l_id_tip
     AND last_date <= trunc(to_date('06/03/2007','dd/mm/yyyy'))  ;
end;
/

As blushadow and Don said, ther won't be a noticeable difference in performance, but the TRUNC is not required.
SQL> ALTER SESSION SET nls_date_format  = 'dd/mm/yyyy hh24:mi:ss';
Session altered.
SQL> SELECT TRUNC(TO_DATE('06/03/2007','dd/mm/yyyy')) trunced,
  2         TO_DATE('06/03/2007','dd/mm/yyyy') no_trunc
  3  FROM dual;
TRUNCED             NO_TRUNC
06/03/2007 00:00:00 06/03/2007 00:00:00Removing the TRUNC might save you another millisecond or 2 :-)
John

Similar Messages

  • How to find out the selected column in Table Control

    Hi all,
          How to find out the selected column in Table Control?
    Thanks & Regards,
    YJR

    Hi,
    Let your table control name in Screen painter be TC1.
    READ TABLE TC1-COLS INTO WA_COLS (some wok area)
                 WITH KEY SELECTED = 'X'.
            IF SY-SUBRC = 0.
              CLEAR: W_DUMMY, W_COL_NAME.
              SPLIT WA_COLS-SCREEN-NAME AT '-' INTO W_DUMMY
                                                   W_COL_NAME.
            endif.
    W_COL_NAME gives you the column name.
    Hope it helps.
    cheers
    sharmistha

  • How to find out  the selected line in list

    Hi all,
    Can any one tell me how to find out the selected event in the list

    Your subject said 'selected <b>line</b> in list' and your description says 'selected <b>event</b> in the list'. Which one is it you want to know?
    For line you will use the event AT LINE-SELECTION and for event you will use AT USER-COMMAND.
    Please reward and close if answered, if not, please revert back to the forum with more details.
    Thanks,
    Srinivas

  • How to find out the selected item in the lsit

    Hi all,
    How to find out the selected item in the list,can any please post some examples which easy to understand,because iam not a good programmer

    This sample program uses a checkbox as selection,  you could also use a HOTSPOT.
    report zrich_0002 no standard page heading.
    data: imara type table of mara with header line.
    data: check_box(1) type c,  
       report_lines type i.
    start-of-selection.
    * Create the gui status with BACK button in standard place
    * and a READ button in the application toolbar
      set pf-status 'CHECK'. 
    select * into corresponding fields of table imara           from mara up to 100 rows.
    loop at imara.   
    write:/ check_box as checkbox, imara-matnr, imara-matkl.  
    hide imara-matnr. 
    endloop.
      report_lines  = sy-linno - 1.
    top-of-page. 
    write: 'List of materials'.  uline.
    top-of-page during line-selection.  write:  'Material.....'.  uline.
    at user-command. 
    case sy-ucomm.  
    when 'READ'.   
      check_box = space.    
    set pf-status 'CHECK' excluding 'READ'.
          do report_lines times.       
    read line sy-index field value check_box.    
       if check_box = 'X'.        
    write:/  'You have selected material',
    imara-matnr.       
    endif.   
      enddo. 
    endcase.
    Regards,
    Rich Heilman

  • Cs6: Masking mode doesn't function - can paint the selection correctly - but then clicking the masking tool icon - nor selection ist made. Can I repair that?

    Cs6: Masking mode doesn't function - can paint the selection correctly - but then clicking the masking tool icon - nor selection ist made. Can I repair that?

    Can I repair that?
    Repair what? Your description seems a bit unclear, maybe posting a few screenshots can help clarify the issue.
    Are you talking about Quick Mask Mode?

  • How to find out the selection screen values

    Hi All,
    in BI we are having the maximum allowed cells as 500000 for a report.
    for some of the reports execution fetching the data morethan 500000 by different users.
    i could findout the report and user who has executed, But i wanted to findout for which selection user has executed.
    is it possible to find out...please help.
    Thanks,
    Krishna.

    Hi,,
    Yes it is possible.
    Open your query result in the design mode by going to BEx Analyzer->Design ToolBar
    Now take one text element and assign it to the variable which you have used for the selection screen.
    Take the same number of text element as there are in selection screen.
    Exit the design mode. In place of the text element you will find the value of the variables assigned to them.

  • Function which determines the selection period dropdown on MSS Reporting

    Hi
    I need the function which detemines the dropdown of the selection period on the MSS reporting screen on the Portal.
    I know that function: HRWPC_GENERAL_KEYDATE_GET determines the default keydate.
    Can anybody please assist?
    Regards
    Margariet

    Hi
    Is there anybody who can assist me with this please?
    iet
    Regards
    Margar

  • Is there a way to find out the selected no. of words on pages for ipad

    I'm writing a speech for school and I wanted to know how many words is a certain paragraph ....pages for ipad

    No, not in Pages for iOS. Just a word count for the complete file. Workaround: copy the selected text into a new file.

  • How to find out the selected line in the table control

    Hi Guys,
    i have a requirement like this. i have table control and the internal table for that table control as IT_CASE. this internal table i declared as CHECKBX, MATNR, QUANTITY. but when i am enter the values in the table control i am getting the values in MATNR and QUANTITY in the that internal table IT_CASE. but when iam selecting that that line iam not getting CHECKBOX as 'X' in that internal table IT_CASE. i declared the table control as CAS_CONTROL and in that i have given the "w/selcolum" property as IT_CASE-CHECKBOX. now i want to fill that CHECKBOX as 'X' inthat internal table IT_CASE whatever the lines we are selecting only for those lines i want to fill up as 'X' in that internal table.
    Can you please suggest any one reg this.
    Thanks in advance
    Rahul

    Hello body,
    You can give a name such as 'SEL' in  w/selcol and declare SEL as char1. Then follow the coading.
    in TOP.
    data: sel type c.
    PROCESS AFTER INPUT.
    user_command_0011.
    loop at <Your internal table>.
    module get_data.
    endloop.
    Inside Module get_data.
        if sy-ucomm = <Your Fcode>
        if sel = 'X'.
           <Your internal table>-<Field for checkbox> = 'X'.
          append <Your internal table>.
        endif.
      endif.
    I think your issue is resolved.
    Regards.
    S Mahanta.

  • How to find out the Batch job selection screen values

    Dear Users,
    One of our users has set up a Batch job by manually entering values into the Selection screen of a report instead of picking up a Variant. We would like to know the values entered on selection screen since the job has failed and the user doesn't remember the selection screen values entered.
    Can anyone please advise if there is a way we can figure out the selection screen values entered?
    Thanks,
    Vijay

    Hi,
    You can debug your failed job by going to 'SM37', type in 'JDBG' in the command line ( no '/' ), put the cursor on the job and press enter - will take you to the job in debug mode.
    You can do this only after the job has finished execution. This will simulate the exact background scenario with the same selection screen values as used in the job.
    So type in the transaction code 'JDBG' and place your cursor on the job after It has finished. It will take you to a SAP program in debug mode. Step through this program which is about 10 lines, after this your program will be executed in the debug mode.
    Check the selection screen values.

  • How gray out the fields in selection screen with parameters

    Hi,
    Can any one help me how to gray out the selection screen fields
    Start-of-selection----
    Parameters : p_status TYPE edids-status MODIF ID xyz DEFAULT co_51.
    End-of-selection----
    i want to grayed out the field p_status.
    except At selection-screeen output, can any one suggest the other method of gray out the above field.
    Thank u
    B Ravi Kumar

  • How to capture the selected values from module pool dialog list box !

    Hi experts,
    Can anyone help me out in capturing the values from the list box.
    i am able to set the values in the list box.But i am not able to capture the selected value from the list box. Always the list box name is getting as "space"
    I also tried in using the FM "VRM_GET_VALUES" but it is retireving all the values. Is there is any flag for filttering out the selected value.
    Your inputs are appreciated.
    Thanks,
    Vijay.

    Along with the PBO and PAI event, add a POV event in the flow logic of the screen
    DEMO_DROPDOWN_LIST_BOX -is a good demo example.
    PROCESS ON VALUE-REQUEST.
    FIELD structure_name-field_name MODULE create_dropdown_box.
    In the report :
    MODULE create_dropdown_box INPUT.
      SELECT carrid carrname
                    FROM scarr
                    INTO CORRESPONDING FIELDS OF TABLE itab_carrid.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'CARRID'
                value_org       = 'S'
           TABLES
                value_tab       = itab_carrid
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc <> 0.
      ENDIF.
    ENDMODULE.
    In the layout, assign a Function Code , for eg : 'SELECTED' to the listbox and lets say name of the field is SDYN_CONN-CARRID. So in the PAI module,
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'SELECTED'.
          MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.
      ENDCASE.
    ENDMODULE.
    sdyb_conn-carrid will contain your selected field

  • Display/Print the Selection criteria entered by USER on the ALV Report o/p?

    Hi Experts,
    I hv a requirement of to print/display the Selection criteria entered by user in the selection screen.........on the top portion of the ALV report output lay out.
    There is a FM for this purpose, but, I forgot its name!!
    So, let me know the FM or FMs, so that, will choose, which is best one,
    or the piece of code, which covers all select-option entries..........appreciated.
    thanq
    Edited by: SAP ABAPer on Sep 3, 2008 6:35 PM

    Use the Function RS_REFRESH_FROM_SELECTOPTIONS get the selection details, now format the data accordingly in the TOP_OF_PAGE using the calss CL_DD_DOCUMENT.
    Check the below mention code.
    REPORT  ztest_page.
    TABLES: sflight.
    DATA : it_flight TYPE TABLE OF sflight WITH HEADER LINE.
    DATA BEGIN OF it_sel_opt OCCURS 0.
            INCLUDE STRUCTURE rsparams.
    DATA END   OF it_sel_opt.
    SELECT-OPTIONS: s_carrid FOR sflight-carrid.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO TABLE it_flight
       WHERE carrid IN s_carrid.
    END-OF-SELECTION.
      CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
        EXPORTING
          curr_report     = sy-repid
        TABLES
          selection_table = it_sel_opt
        EXCEPTIONS
          not_found       = 01
          no_report       = 02.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = sy-repid
          i_callback_html_top_of_page = 'TOP_OF_PAGE'
          i_structure_name            = 'SFLIGHT'
        TABLES
          t_outtab                    = it_flight
        EXCEPTIONS
          program_error               = 1
          OTHERS                      = 2.
    *&      Form  top_of_page
    *       text
    *      -->DOCUMENT   text
    FORM top_of_page USING document TYPE REF TO cl_dd_document.
      DATA : dl_text(255) TYPE c.  "Text
    * Add new-line
      CALL METHOD document->new_line.
      CALL METHOD document->new_line.
      CLEAR : dl_text.
    * program ID
      dl_text = 'Program Name :'.
      CALL METHOD document->add_gap.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_heading_int.
      CLEAR dl_text.
      dl_text = sy-repid.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      CLEAR : dl_text.
      dl_text = 'Selection Criteria'.
      CALL METHOD document->add_gap
        EXPORTING
          width = 34.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      CLEAR : dl_text.
      CONCATENATE 'SELECT Option' 'SIGN' 'OPTION' 'LOW' 'HIGH'
      INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      CALL METHOD document->add_gap
        EXPORTING
          width = 34.
      CALL METHOD document->add_text
        EXPORTING
          text         = dl_text
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
      CALL METHOD document->new_line.
      LOOP AT it_sel_opt.
        CLEAR : dl_text.
        CONCATENATE it_sel_opt-selname  it_sel_opt-sign
         it_sel_opt-option it_sel_opt-low it_sel_opt-high
        INTO dl_text SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
        CALL METHOD document->add_gap
          EXPORTING
            width = 34.
        CALL METHOD document->add_text
          EXPORTING
            text         = dl_text
            sap_emphasis = cl_dd_area=>heading
            sap_color    = cl_dd_area=>list_negative_inv.
    * Add new-line
        CALL METHOD document->new_line.
      ENDLOOP.
    ENDFORM.                    "top_of_page

  • How to optimize the select query that is executed in a cursor for loop?

    Hi Friends,
    I have executed the code below and clocked the times for every line of the code using DBMS_PROFILER.
    CREATE OR REPLACE PROCEDURE TEST
    AS
       p_file_id              NUMBER                                   := 151;
       v_shipper_ind          ah_item.shipper_ind%TYPE;
       v_sales_reserve_ind    ah_item.special_sales_reserve_ind%TYPE;
       v_location_indicator   ah_item.exe_location_ind%TYPE;
       CURSOR activity_c
       IS
          SELECT *
            FROM ah_activity_internal
           WHERE status_id = 30
             AND file_id = p_file_id;
    BEGIN
       DBMS_PROFILER.start_profiler ('TEST');
       FOR rec IN activity_c
       LOOP
          SELECT DISTINCT shipper_ind, special_sales_reserve_ind, exe_location_ind
                     INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
                     FROM ah_item --464000 rows in this table
                    WHERE item_id_edw IN (
                             SELECT item_id_edw
                               FROM ah_item_xref --700000 rows in this table
                              WHERE item_code_cust = rec.item_code_cust
                                AND facility_num IN (
                                       SELECT facility_code
                                         FROM ah_chain_div_facility --17 rows in this table
                                        WHERE chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
                                          AND div_id = (SELECT div_id
                                                          FROM ah_div --8 rows in this table
                                                         WHERE division = rec.division)));
       END LOOP;
       DBMS_PROFILER.stop_profiler;
    EXCEPTION
       WHEN NO_DATA_FOUND
       THEN
          NULL;
       WHEN TOO_MANY_ROWS
       THEN
          NULL;
    END TEST;The SELECT query inside the cursor FOR LOOP took 773 seconds.
    I have tried using BULK COLLECT instead of cursor for loop but it did not help.
    When I took out the select query separately and executed with a sample value then it gave the results in a flash of second.
    All the tables have primary key indexes.
    Any ideas what can be done to make this code perform better?
    Thanks,
    Raj.

    As suggested I'd try merging the queries into a single SQL. You could also rewrite your IN clauses as JOINs and see if that helps, e.g.
    SELECT DISTINCT ai.shipper_ind, ai.special_sales_reserve_ind, ai.exe_location_ind
               INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
               FROM ah_item ai, ah_item_xref aix, ah_chain_div_facility acdf, ah_div ad
              WHERE ai.item_id_edw = aix.item_id_edw
                AND aix.item_code_cust = rec.item_code_cust
                AND aix.facility_num = acdf.facility_code
                AND acdf.chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
                AND acdf.div_id = ad.div_id
                AND ad.division = rec.division;ALSO: You are calling ah_internal_data_pkg.get_chain_id (p_file_id) every time. Why not do it outside the loop and just use a variable in the inner query? That will prevent context switching and improve speed.
    Edited by: Dave Hemming on Dec 3, 2008 9:34 AM

  • How do I get the packing slips to print the selections made under a buy now button

    So I started using paypal packing slips about a year and half ago, instead of manually copying the info into an excel document version to create the packing slip. I use the packing slips to make sure I have the order correct and done before packing and then printing out the label. For the past year and half if it is a 'buy now' button with drop down selections, I have to manually edit each one to copy and paste the info from the payment notification into the end of  'thank you' text field. and in the process I have to remember to de-select the save button each time so I don't accidently put that info on my next order. Is there a way either with the button itself or the packing slip to select to have it print out the selections made on the packing slip? Given that in a few cases there are several drop downs, I need them all to list. It would save me a little time with each order and more importantly make sure I have the correct information on the correct packing slip. The information is there. just have not figured out how to automatically have it print on the packing slip. For trivia: I have no problem when I send an invoice or have an item with no selections, but for those items that have selections, because most of my items have several similar variations available, it would be really nice to be able to have it automatically put that information on the packing slip.
    Thanks for any help.

    Could you check your "shrink to fit" and scaling settings? Easiest way is:
    tap the Alt key > File > Page Setup
    The default would be
    * Scale: 100
    * Shrink to fit checked (this disables editing the Scale box, but you can uncheck it, edit, then re-check it)
    If those are at their default settings, perhaps they do not work well for particular pages? You can use Print Preview to examine how shrink-to-fit works on that page and override it by using a different percentage instead.
    Occasionally Firefox printer data gets garbled and manual adjustments don't seem to work. In that case, you can "reset" those printer settings. This article has the steps: http://kb.mozillazine.org/Problems_printing_web_pages#Reset_printer

Maybe you are looking for

  • Error while displaying JSP page

    Hi Gents, I am getting the below error while make forward to another page. Please advise Error Page Exception Details. oracle.apps.fnd.framework.OAException: No data found for region (/oracle/apps/ak/xxperson/webui/managePersonPG).      at oracle.app

  • How to compare substitution variable name to static member names (not data)?

    Is there a way to write a BSO member formula that compares a substitution variable against the name of a static member (not the data value of the member) For example, I have a BSO database that has the sub variable &CurrMth (which is set the real cur

  • Auto Submit on an external form

    This is not just a question. I'm so frustrated that I'll happily give $20 to whoever can answer this. (providing it works, of course) I run a comedy company, and am giving my customers the ability to sign up for various comedians' mailinglists all in

  • UNC Path

    Hi I just installed service pack 10 on my clients' server an now can't run the import package. I can successfully upload and preview the upload file. I even validated and processes my transformation file with the upload file and it ran successfully. 

  • Can i charge US Iphone 3g in Hong Kong??

    Hello, i m visiting Hong Kong, and i m wonder if i can charge my iphone 3g, purchased in USA in Hong Kong? The power outlet is different compared to USA. Thanks