Performance in the select statement

Hi All,
(select a.siteid siteid,a.bpaadd_0 bpaadd_0,a.bpanum_0 bpanum_0,
case when a.bpaaddlig_0 = '' then '-' else a.bpaaddlig_0 end
address1,
case when a.bpaaddlig_1 = '' then '-' else a.bpaaddlig_1 end
address2,
case when a.bpaaddlig_2 = '' then '-' else a.bpaaddlig_2 end
address3,
case when a.bpades_0 = '' then '-' else a.bpades_0 end place,
case when a.cty_0 = '' then '-' else a.cty_0 end city,
case when a.poscod_0 = '' then '-' else a.poscod_0 end
pincode,
case when b.cntnam_0 = '' then '-' else b.cntnam_0 end
contactname,
case when b.fax_0 = '' then '-' else b.fax_0 end fax,
case when b.MOBTEL_0 = '' then '-' else b.MOBTEL_0 end mobile,
case when b.TEL_0 = '' then '-' else b.TEL_0 end phone,
case when b.web_0 = '' then '-' else b.web_0 end website,
c.zinvcty_0 zcity,c.bpainv_0 bpainv_0,c.bpcnum_0 bpcnum_0
from lbcreport.bpaddress@info a,lbcreport.contact@info b
,lbcreport.bpcustomer@info c
where (a.bpanum_0=b.bpanum_0) and (a.cty_0 = c.zinvcty_0) and
(a.siteid = c.siteid))
In the above query Is there any performance degradation could i proceed with same query
or any other solution is there to increase the speed of the query.
in one select statement these many cases are allowed ah?
Please could anybody help me in this?
Thanks in advance
bye
Srikavi

Change you query as follows...
(select
     a.siteid siteid,
     a.bpaadd_0 bpaadd_0,
     a.bpanum_0 bpanum_0,
     nvl(a.bpaaddlig_0, '-') address1,
     nvl(a.bpaaddlig_1,'-' ) address2,
     nvl(a.bpaaddlig_2,'-' )  address3,
     nvl(a.bpades_0,'-' ) place,
     nvl(a.cty_0,'-' ) city,
     nvl(a.poscod_0,'-' ) pincode,
     nvl(b.cntnam_0,'-' ) end
     contactname,
     nvl(b.fax_0,'-' )  fax,
     nvl(b.MOBTEL_0,'-' )  mobile,
     nvl(b.TEL_0,'-' )  phone,
     nvl(b.web_0,'-' )  website,
     c.zinvcty_0 zcity,c.bpainv_0 bpainv_0,c.bpcnum_0 bpcnum_0
from
     lbcreport.bpaddress@info a,
     lbcreport.contact@info b,
     lbcreport.bpcustomer@info c
where
     (a.bpanum_0=b.bpanum_0) and
     (a.cty_0 = c.zinvcty_0) and
     (a.siteid = c.siteid))
/ For performace check the execution plan of the query.. also BluShadow's post
Regards
Singh

Similar Messages

  • Case sensitive statement in the select-statement

    Hi All,
    i have a table in the abap-dictionary filled with names...when i try to select them with the select-statement with condition:
    table-name_column like 'some_name'
    I have encountered some problems...the inquiry is case-sensitive. What i want to do is to read the value from the abap-dictionary table uppercase or lowercase and compare it with the needed value also translated in uppercase or lowercase.
    The only idea i have is to select all values of the dictionary table into an internal table and to translate the values there in uppercase or lowercase and then to loop trough it. But this approach would cost a lot of performance.
    Do someone has an other proposal?

    check...
    Select statement
    It would be difficult , because it is based on how data is stored in the data base , now consider the scenario of the system i am using , we can material description as 'test' or 'TEST' , 'Test' .
    If in your system there are only stored in either caps or small the you can perform the select twice .
    But i myself dont find it to be such a good solution , but you can give it a try
    There is one more solution specific to material description ,and that is in the table MAKT there is a field MAKTG , which stored the description in uppercase , so for this you can first convert the description to uppercase and then perform select on this field

  • Substring in the select statement

    Hi,
    Have a table with 5 columns in it...
    Table A
    col1
    col2
    col3
    col4
    col5
    Want to retrieve some columns from that table using the select query, in which substring will be used to extract a part of string from each value contained in the col3 on executing select statement.
    How to use the substring in the select statement to perform the above?
    Regards

    What's wrong with <tt>SUBSTR(col3,4,2)</tt> etc? What do the other columns have to do with it?

  • How to know the select statement perfomence

    how to know the select statement perfomence. suppose i have 10 select statements in my program. how will i know which select statement not performance wise poor.

    Go to ST04/
    Click on Detail Analysis menu button.
    Click on the SQL Request button.
    In the pup up give <table name> and execute.
    Then you will get a list of all the programs that have a select on that table.
    Or ST05 transaction t start the trace and run your program .Deactivate the trace in st05 .
    and display the trace.
    Regards,
    Ravi

  • Class not getting called by the Select Statement

    Dear All,
    I have created a new class "Z1_EXIT_VARIABLES" in my Dev system and coded for a new Exit Variable for InfoObject "0FISCPER3" in this class.
    But on debugging the Function module "EXIT_SAPLRRS0_001" (INCLUDE ZXRSRU01), I could find that the Select statement
    <i>select CLSNAME
    into  l_clsname
    from VSEOIMPLEM
    where REFCLSNAME = 'ZBWIF_VAR_EXIT'.
    </i>
    calls ALL the classes mentioned in the table "VSEOIMPLEM" with    REFCLSNAME = ZBWIF_VAR_EXIT, EXCEPT the class "Z1_EXIT_VARIABLES". Therefore, the code written by me is not getting executed.
    Also, after debugging the same function module in Quality system, I could find that not all of the classes mentioned in the table "VSEOIMPLEM"are getting called by the select statement.
    (I do not have authorization for CMOD in my Dev system)
    Can anyone suggest a possible solution to the problem ?
    Regards
    Shalabh Jain

    Hi,
    Still waiting for response.
    The issue is not with finding control and performing action on it.
    The coded UI automation script is able to find the control and performing click on that, and after that is is supposed to display the results, which is not happening.
    I am not able to find out why the results are not displaying with coded UI but it's working as expected with SELENIUM web driver.
    I have to do it with CODED UI VS2013, So i request you to give me some solution for this issue, I have done automation earlier for some similar web applications, but never faced this situation.
    Studio: VS2013
    Scripting Language: C#
    HtmlHyperlink performSearchLink = new HtmlHyperlink(inventoryWindow);
     performSearchLink.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, "Search");
                Mouse.Click(performSearchLink);
    this code is working fine, it's clicking on search but not displaying the results.
    someone reply asap.
    Thanks
    Adrusta

  • If I want to order by dateAdded to I have to include it in the select statement like

    If I do this:
    <cfquery name="chart" datasource="#datasource#">
    select behaviourID,score, dateAdded2 = convert(varchar,
    dateAdded , 101)
    from staff_charts_data
    where userID =
    <cfqueryparam value="#arguments.userID#"
    cfsqltype="cf_sql_integer"> AND
    NOT score = 5
    </cfquery>
    If I want to order by dateAdded to I have to include it in
    the select statement like so:
    <cfquery name="chart" datasource="#datasource#">
    select behaviourID,score, dateAdded2 = convert(varchar,
    dateAdded , 101),dateAdded
    from staff_charts_data
    where userID =
    <cfqueryparam value="#arguments.userID#"
    cfsqltype="cf_sql_integer"> AND
    NOT score = 5
    </cfquery>

    you should be able to order by dateAdded without it being in
    the select clause. The only time the order by field has to be in
    the select clause is when your query has an aggregate and group by
    clause, like this:
    select field1, field2, max(field3) as youralias
    from sometables
    where whatever
    group by field1, field2
    order by ???
    You can only order field1, field2, max(field3) or youralias.
    You can't order by field4.

  • Issue with Past Month data in the Select Statement

    Hi,
    I written the following query,
    SELECT   /*+NO_MERGE(A)*/
                CASE
                   WHEN snap_shot_date > a.q3
                   AND snap_shot_date <= a.q4
                      THEN q4char
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN q3char
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN q2char
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN q1char              
                END snap_shot_date,
                CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN 1
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN 2
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN 3
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN 4
                END sort_by,
                pillar3_exposure_class_code, pd_band_description,
                ROUND (SUM (p3.ead_post_sec_post_crm)),
                ROUND (SUM (notional_principle)),
                DECODE (SUM (notional_principle),
                        0, 0,
                        ROUND (  SUM (DECODE (exposure_type,
                                              'UNDRAW', ead_post_sec_post_crm,
                                              0
                               / SUM (notional_principle),
                               4
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (  SUM (pd_value * p3.ead_post_sec_post_crm)
                               / SUM (p3.ead_post_sec_post_crm),
                               2
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (SUM (rwa) / SUM (p3.ead_post_sec_post_crm), 4)
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (  SUM (lgd_rate * p3.ead_post_sec_post_crm)
                               / SUM (p3.ead_post_sec_post_crm),
                               2
                TO_CHAR (MAX (a.max_date), 'FMMonth DD, YYYY')
           FROM summary.pillar3 p3,
                (SELECT DISTINCT (month_end_date) max_date,
                                 LAST_DAY (month_end_date) q4,
                                 TO_CHAR (LAST_DAY (month_end_date),
                                          'MON YYYY'
                                         ) q4char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -3) q3,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -3),
                                     'MON YYYY'
                                    ) q3char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -6) q2,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -6),
                                     'MON YYYY'
                                    ) q2char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -9) q1,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -9),
                                     'MON YYYY'
                                    ) q1char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -12) q0
                            FROM rcdwstg.stg_bcar_detail) a
          WHERE snap_shot_date BETWEEN ADD_MONTHS (a.max_date, -12) AND a.max_date
       GROUP BY CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN q4char
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN q3char
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN q2char
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN q1char
                END,
                CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN 1
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN 2
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN 3
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN 4
                END,
                pillar3_exposure_class_code,
                pd_band_description
       ORDER BY 2 DESC;I have written the query to get the latest 12 months data from a table and split that into 4 quarter to show in the Cognos Report. But when the table having 13th or the past months data, the select statement is showing Empty values in the first two columns and fetching the 13 month data too.
    Can anyone help me in this to avoid the problem.
    Thanks
    Radha K

    WHERE snap_shot_date BETWEEN ADD_MONTHS(TRUNC(a.max_date, 'MM'), -11) AND  a.max_date
    ....

  • How can I call a Page Process from the Select statement for Report Page

    I'm able to call a javascript using the below:
    img src="#IMAGE_PREFIX#add2.gif" border="0" alt="Icon 4" onClick="javascript:add_connect1('||CPORT.ID||')"
    But Now,
    I'd like to accomplish (2) New things:
    1. instead of using,....... onClick="javascript:add_connect1,
    I'd like to call a Page Process, onClick=
    2. I'd like to be able to call two different processes onClick.
    a. onClick="javascript:passBack('||ID||')"
    b. onClick= <Please see my question #1 above>
    Can someone please help me with the syntax for this,
    If indeed it can even be done?
    Thanks- Gary

    Greg.
    It seems that my situation is the one you describe in you second paragraph, where you mention:
    you could then add the ID column value as a parameter to the javascript functionBut,
    I do not know how to reference the variable in my javascript nor how to use it in my on-demand process.
    If you can hellp me past this last little bump, then I think I will be able to use these skills in Sooo many different areas of my design.
    Here's what I've got so far:
    A. In the select statement I identify the javascript as:
    onClick="javascript:connect_port('<font color=blue>''||ID||''</font>')";
    B. In my javascript I have this:
    <script language="JavaScript" type="text/javascript">
    function connect_port(ID)
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=CONNECT_PORT',0);
    gReturn = get.get();
    get = null;
    </script>
    C. In my on demand function I have this:
    BEGIN
    INSERT INTO CCONNECTIONS_B
    BLDG_ID,CLST_ID,PORT_ID,STRAND_ID
    ) VALUES
    :P2004_BLDG_ID,:P2004_CLST_ID,:P2004_PORT_ID,:P2004_STRAND_ID1
    END;
    You can see that I dont know how to use the value for 'ID' in either the javascript or the On-Process function.
    If you can help me out with this one, Then I can imitate it for the rest.
    -Gary
    Edited by: garyNboston on Apr 3, 2009 6:44 AM
    Edited by: garyNboston on Apr 3, 2009 6:44 AM
    Edited by: garyNboston on Apr 3, 2009 6:45 AM
    Edited by: garyNboston on Apr 3, 2009 6:47 AM

  • How to test the select statement.

    Hi All,
    How to test the select statement.
    Is there any Oracle sqlplus  or toad kind of tool to  test the query.
    thanks
    siva

    Use SQL Trace (ST05) and choose 'Explain one SQL Request'. Enter your SQL command as it should be executed in the underlying database. e.g. if the db is Oracle, the statement should be entered as:
    SELECT matnr,werks,lvorm,dispo
    FROM marc
    WHERE mandt = :a AND
                 matnr = :b AND
                 werks = :c
    In the above :a, :b and :c are place holders for the actual comparison values. You dont have to enter those values. When you choose 'Explain' button, you will find the 'Execution Plan'. The important parameter which denotes the efficiency of the SQL statement is the 'Cost'. The cost should be as low as possible. The table access should be through INDEX UNIQUE SCAN. If you get a FULL TABLE SCAN and higher cost, you need to fine-tune your statement by modifying the where clause.
    If you dont know Oracle SQL statements, execute the program in trace mode and go to the trace and you will find the underlying SQL statements issued to the database.
    Regards
    Suresh Radhakrishnan

  • Need a help in the Select statement

    How to use the table name dynamically in the Select Statement in Oracle 9.i ?

    This?
    sql>
    select *
    from &table
    old 2: from &table
    new 2: from dual
    D

    Or this..?
    sql>
    declare
    tab varchar2(31) := 'dual';
    v varchar2(10);
    begin
    execute immediate 'select * from '||tab into v;
    dbms_output.put_line(v);
    end;
    X
    PL/SQL procedure successfully completed
    jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Restricting records in the select statement

    Hi,
    I have one requirement where in i need to restrict my select statement to get only 250 records in the output table.
    Here are the select statements i am using....
        SELECT a~ebeln
                     a~lifnr
                     a~ekgrp
                     b~werks
                     b~matnr
               FROM ekko AS a INNER JOIN ekpo AS b
               ON aebeln = bebeln
               INTO TABLE i_ekko
               WHERE a~ebeln IN r_ebeln AND
                            a~lifnr IN r_lifnr AND
                            a~ekgrp IN r_ekgrp AND
                            b~werks IN r_ewerk AND
                            b~matnr IN r_matnr AND
                            a~bstyp = 'F'.
                IF NOT i_ekko[] IS INITIAL.
    Select Vendor name
               SELECT lifnr
                            name1
                      FROM lfa1
                      INTO TABLE i_lfa1
                      FOR ALL ENTRIES IN i_ekko
                      WHERE lifnr = i_ekko-lifnr.      
    Here if i restrict the first select statement to get only 250 records then i am not getting the desired record in the second select statement.
    Could anyone let me know how to write the select statement.
    Regards,
    Ramesh

    restric the first select using up to 250.
    sort the i_ekko by vendor name.
    ex: sort i_ekko by lifnr.
    use second select statement here.

  • Decode in the select Statement

    Hi All,
    I am using the decode function in the select statement....but as i am using the group by in the select statement....i am not able to run the same query
    How to tackle this problem of handling the decode ....while we have group by also.
    This is bit urgent
    Thanks for your help
    Ramya

    Hi,
    Thanks for the quick reply.
    Here is the code...i have included the decode for the customer carrier code...
    SELECT c.trx_number invoice_number,
    c.trx_date invoice_date,
    ctl.sales_order_date order_date,
    c.ship_date_actual ship_date,
    c.purchase_order,
    ctl.sales_order order_number,
    olv.ordered_item item,
    msi.description item_description,
    olv.ordered_quantity quantity,
    olv.unit_selling_price unit_price,
    olv.unit_selling_price * olv.ordered_quantity amount,
    olv.tax_value,
    rc.customer_number,
    csta.customer_carrier_code,
    (SELECT decode(customer_carrier_code, NULL, 'Shipping & Handling', 'Shipping') sh
    FROM xx_cust_ship_to_addresses_v cstaa,
    ra_addresses ara
    WHERE cstaa.location_id = ad.location_id
    AND ara.location_id = ad.location_id) SH,
    rc.customer_name invoice_to_name,
    rct.name invoice_type,
    olv.sold_to,
    olv.ship_to_location,
    olv.ship_to_address1,
    olv.ship_to_address2,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -2, LENGTH(olv.ship_to_address5)) ship_to_country,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -9, 6) ship_to_postalcode,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -12, 2) ship_to_state,
    SUBSTR(olv.ship_to_address5, 1, LENGTH(olv.ship_to_address5) -15) ship_to_city,
    olv.invoice_to_address1,
    olv.invoice_to_address2,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -2, LENGTH(olv.invoice_to_address5)) invoice_to_country,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -9, 6) invoice_to_postalcode,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -12, 2) invoice_to_state,
    SUBSTR(olv.invoice_to_address5, 1, LENGTH(olv.invoice_to_address5) -15) invoice_to_city,
    olv.flow_status_code,
    olv.terms net_terms,
    olv.freight_terms_code freight_terms,
    olv.fob_point_code fob
    FROM ra_customer_trx_all c,
    ra_customer_trx_lines_all ctl,
    ra_cust_trx_types rct,
    jtf_rs_salesreps rs,
    ra_customers rc,
    ra_addresses ad,
    ra_site_uses su,
    mtl_system_items msi,
    oe_order_headers_v ohv,
    oe_order_lines_v olv,
    rcv_lot_transactions tl,
    rcv_shipment_lines sl,
    rcv_shipment_headers rsh,
    rcv_transactions rt,
    wsh_delivery_details wdd,
    xx_cust_ship_to_addresses_v csta
    WHERE to_char(ohv.order_number) = ctl.sales_order
    AND ctl.customer_trx_id = c.customer_trx_id
    AND c.cust_trx_type_id = rct.cust_trx_type_id
    AND c.org_id = rs.org_id
    AND c.primary_salesrep_id = rs.salesrep_id
    AND c.ship_to_site_use_id = su.site_use_id
    AND su.address_id = ad.address_id
    AND ad.customer_id = rc.customer_id
    AND ctl.inventory_item_id = msi.inventory_item_id
    AND ohv.header_id = olv.header_id
    AND olv.line_id = wdd.source_line_id(+)
    AND to_char(olv.line_id) = ctl.interface_line_attribute6
    AND tl.shipment_line_id = sl.shipment_line_id
    AND sl.shipment_header_id = rsh.shipment_header_id
    AND tl.transaction_id = rt.transaction_id
    AND csta.location_id = ad.location_id;
    GROUP BY c.trx_number,
    csta.customer_carrier_code,
    c.trx_date,
    c.creation_date,
    c.ship_date_actual,
    c.sold_to_customer_id,
    c.bill_to_customer_id,
    c.bill_to_site_use_id,
    c.ship_to_customer_id,
    c.ship_to_site_use_id,
    c.purchase_order,
    (SELECT decode(customer_carrier_code, NULL, 'Shipping & Handling', 'Shipping') sh
    FROM xx_cust_ship_to_addresses_v cstaa,
    ra_addresses ara
    WHERE cstaa.location_id = ara.location_id
    AND ara.location_id = ad.location_id),
    ctl.sales_order,
    ctl.sales_order_date,
    ctl.tax_rate,
    ctl.customer_trx_id,
    ctl.taxable_amount,
    rc.customer_number,
    olv.ordered_item,
    olv.unit_selling_price,
    olv.unit_list_price,
    olv.tax_value,
    olv.unit_cost,
    olv.ordered_quantity,
    rs.name,
    rc.customer_name,
    rc.customer_id,
    rc.party_id,
    rc.party_number,
    ad.address_id,
    rct.name,
    msi.description,
    olv.unit_selling_price * olv.ordered_quantity,
    c.org_id,
    ohv.header_id,
    olv.sold_to,
    olv.ship_from,
    olv.ship_to_location,
    olv.ship_to_address1,
    olv.ship_to_address2,
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -2, LENGTH(olv.ship_to_address5)),
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -9, 6),
    SUBSTR(olv.ship_to_address5, LENGTH(olv.ship_to_address5) -12, 2),
    SUBSTR(olv.ship_to_address5, 1, LENGTH(olv.ship_to_address5) -15),
    olv.invoice_to_location,
    olv.invoice_to_address1,
    olv.invoice_to_address2,
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -2, LENGTH(olv.invoice_to_address5)),
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -9, 6),
    SUBSTR(olv.invoice_to_address5, LENGTH(olv.invoice_to_address5) -12, 2),
    SUBSTR(olv.invoice_to_address5, 1, LENGTH(olv.invoice_to_address5) -15),
    olv.flow_status_code,
    olv.terms,
    olv.freight_terms_code,
    olv.shipping_method_code,
    olv.fob_point_code,
    olv.line_id,
    rsh.attribute1,
    rsh.attribute2,
    su.tax_code,
    su.ship_via,
    wdd.tracking_number
    ORDER BY invoice_number;

  • Database adapter and column aliases in the select statement (10.1.3.1)

    Hi,
    Is it possible to use column aliases in the select statement for a database adapter to return an xml element name which is different to the column in the queried table?
    I have tried using
    SELECT EMPLOYEE_ID, FIRST_NAME AS MYNAME, LAST_NAME, SALARY, DEPARTMENT_ID, PHONE_NUMBER, EMAIL, HIRE_DATE FROM HR.EMPLOYEES WHERE (DEPARTMENT_ID = #DEPT_ID)
    but I get the following XML fragment returned
    <Employees>
    <employeeId>100</employeeId>
    <firstName xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
    <lastName>King</lastName>
    <salary>24000</salary>
    Any pointers appreciated.
    Joel.

    That is really interesting.
    When I use the "custom sql" option in the DB adapter wizard, it used the aliases just fine in the return schema.
    Marc

  • Problem in the select statement

    I have to select the values of the fields BEZEI  depending on tha sales order number vbeln. HOw can i write the select statement what will be the tables associated?

    Hi,
    tables: vbak.
    types: begin of ty_vbak,
               vbeln type vbeln,
               kokrs type kokrs,
              end of ty_vbak,
              begin of ty_it_tka01,
                kokrs type kokrs,
                bezei type bezei,
              end of ty_tka01.
    data: it_vbak type table of ty_vbak,
            wa_vbak type ty_vbak,
            it_tka01 type table of ty_tka01,
            wa_tka01 type ty_tka01.
    Select-options: s_vbeln for vbak-vbeln.
    Select VBELN KOKRS from VBAK into table it_VBAK where vbeln in s_vbeln.
    if sy-subrc = 0.
    select KOKRS BEZEI from TKA01 into it_tka01 for all entries in it_vbak where kokrs = it_vbak-kokrs.
    endif.
    Loop at it_vbak into wa_vbak.
    read table it_tka01 into wa_tka01 with key kokrs = wa_vbak-kokrs.
    if sy-subrc = 0.
    * Move data to final internal table.
    endif.
    endloop.
    Regards,
    Satish

  • How to find the select statement has written all selected values into text

    Hi,
    I am using form6i. i am selecting a set of values from database tables based upon some user parameters and writing into the text file using Text_io.put_line . In this case how we can make sure that the text fille contains all the data what we are selected from selected statement. somebody told that there might be chances of aborting of data while writing into the text file. is there any way to fild out the selected statements has written all the selected fields and corresponding output into the .txt file.
    Please suggest me.

    somebody told that there might be chances of aborting of data while writing into the text fileWhat kind of "chance" does that somebody refer to?
    If you want to verify if the number of records (lines) in the file matches the number of records from the cursor, you could re-open the written file in read-mode and count the number of lines by reading one by one, then compare the number of lines with the number of records from the cursor.

Maybe you are looking for