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

Similar Messages

  • Run time Column Name in the Select Statement

    Hi there,
    I face problem while writing sql statment for report in the Oracle reports.
    The prom is I want to bound the where clause column name with the value stored in a variable e.g.
    Select * from emp
    where Column_Name = 'XYZ' ;
    where the variable Column_Name have different values at different times, e.g.
    At a time the value of Column_Name is Dept then
    Select * from emp
    where Dept = 'XYZ' ;
    At other time value of Column_Name is City then
    Select * from emp
    where City = 'XYZ' ;
    Waiting for the response .
    Regards,
    Hafeez

    Hi,
    U can use lexical parameters for the solutions.U must be aware of it, but still i describe how to work it out.
    1)In your datamodel in object navigator create a parameter under User parameter node.Name the parameter, for eg. p_clause.
    set data type of parameter to character.
    2)write a select query eg.
    select * from emp &p_clause; --(THIS IS THE PARAMETER WE CREATED ABOVE)
    3)Now run your report
    Now in your parameter form pass the value for p_clause parameter.
    eg: where name='JACK';
    or
    where city='NEWYORK';
    or where deptno=10;
    But do it in steps as above mentioned.
    Do tell me if it works or not via mail on [email protected]
    Enjoy.......
    navneet jain
    [email protected]

  • Diferences in data from database adapter and EJB

    I'm having a strange behaviour in a BPEL that uses a Database Adapter and EJJB for several database operations.
    What happens is that when I create records in the database through the adapter, if I retrieve them through the EJB, the records returned do not contain the newly inserted data. It seems that there is a cache in the EJB side that is not updated when an new record is inserted. If I restart the server the records appear. this does not happen if I insert through the database adapter and retrieve thought it also.
    Does anyone have a clue about this?
    Thanks in advance

    Hi Pedro
    What kind of code do you have in EJB to retrieve the data. Are you using the standard JNDI Lookup for datasource and then get connection object. Then run the query on this connection. If so, do you have like any Static variables declared that stores this information. Or do you use the Eclipse JPA layer that uses annotation on the Entities generated for each table. Incase if you use JPA architecture, there are some cache settings and may be that could be the reason.
    Thanks
    Ravi Jegga

  • Displaying the Row and Column number in the report

    I am trying to show row and column number in the report (not just web preview). I am using Hyperion Reports Version 7.2.5.168

    use a formula column/row. use RANK function in that. (e.g. Rank([A], asc) will sort the rows based on column A values in ascending order)
    you can use this rank in your heading.
    But frankly this is not so easy. You have to do it in a very intelligent way, so that rank gives you column number/row number any how.
    Have a try and let see if you find a appropriate solution.
    Regards,
    Rahul

  • Submir Report "RSNAST00" and passing parametrs to the selection screen

    Hello ABAP,
    I have to code a Report/TA which gathers some info and then calls RSNAST00.
    The info gathering part is done.
    The info gathered shall be transferred to the report RSNAST00 or to it´s selection screen, tho the selection screen should not be visible. And then RSNAST00 shall do it´s normal job.
    Any hints how i can pass those parameters and make that selection screen not appear?

    Hi florian,
    1. We have to use the comand SUBMIT with the program name and some extensions.
       (please see F1 help on it)
    2. This will call the required program.
    3. We can also pass the required values using WITH Var1 = Val1
    4. we can use the extension AND RETURN so that the selection screen of RSNAST00 does not appear on screen.
    regards,
    amit m.

  • Database version and patchset applied from the operating system level in so

    How to find out the database version and patchset applied from the operating system level in solaris?

    [oracle@rac1 udump]$ cd $ORACLE_HOME/OPatch/
    [oracle@rac1 OPatch]$ pwd
    /u01/app/oracle/product/10.2.0/db_1/OPatch
    [oracle@rac1 OPatch]$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
    [oracle@rac1 OPatch]$ ./opatch lsinventory
    Invoking OPatch 10.2.0.1.0
    Oracle interim Patch Installer version 10.2.0.1.0
    Copyright (c) 2005, Oracle Corporation. All rights reserved..
    Oracle Home : /u01/app/oracle/product/10.2.0/db_1
    Central Inventory : /u01/app/oracle/oraInventory
    from : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc
    OPatch version : 10.2.0.1.0
    OUI version : 10.2.0.1.0
    OUI location : /u01/app/oracle/product/10.2
    Edited by: rajeysh on Jul 31, 2010 1:19 AM

  • 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 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

  • Using column number inplace of column name in SQL Select statement

    Is there a way to run sql select statements with column numbers in
    place of column names?
    Current SQL
    select AddressId,Name,City from AddressIs this possible
    select 1,2,5 from AddressThanks in Advance

    user10962462 wrote:
    well, ok, it's not possible with SQL, but how about PL/SQL?As mentioned, using DBMS_SQL you can only really use positional notation... and you can also use those positions to get the other information such as what the column is called, what it's datatype is etc.
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_rowcount  NUMBER := 0;
    BEGIN
      -- create a cursor
      c := DBMS_SQL.OPEN_CURSOR;
      -- parse the SQL statement into the cursor
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      -- execute the cursor
      d := DBMS_SQL.EXECUTE(c);
      -- Describe the columns returned by the SQL statement
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      -- Bind local return variables to the various columns based on their types
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);      -- Number
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);     -- Date
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);  -- Any other type return as varchar2
        END CASE;
      END LOOP;
      -- Display what columns are being returned...
      DBMS_OUTPUT.PUT_LINE('-- Columns --');
      FOR j in 1..col_cnt
      LOOP
        DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
                                                                                  when 2 then 'NUMBER'
                                                                                  when 12 then 'DATE'
                                                         else 'Other' end);
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('-------------');
      -- This part outputs the DATA
      LOOP
        -- Fetch a row of data through the cursor
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        -- Exit when no more rows
        EXIT WHEN v_ret = 0;
        v_rowcount := v_rowcount + 1;
        DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
        DBMS_OUTPUT.PUT_LINE('--------------');
        -- Fetch the value of each column from the row
        FOR j in 1..col_cnt
        LOOP
          -- Fetch each column into the correct data type based on the description of the column
          CASE rec_tab(j).col_type
            WHEN 1  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
            WHEN 2  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
          ELSE
            DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
            DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
          END CASE;
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('--------------');
      END LOOP;
      -- Close the cursor now we have finished with it
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    DEPTNO - NUMBER
    SAL - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    DEPTNO : 10
    SAL : 2450
    Row: 2
    EMPNO : 7839
    ENAME : KING
    DEPTNO : 10
    SAL : 5000
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    DEPTNO : 10
    SAL : 1300
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    JOB - VARCHAR2
    MGR - NUMBER
    HIREDATE - DATE
    SAL - NUMBER
    COMM - NUMBER
    DEPTNO - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    JOB : MANAGER
    MGR : 7839
    HIREDATE : 09/06/1981 00:00:00
    SAL : 2450
    COMM :
    DEPTNO : 10
    Row: 2
    EMPNO : 7839
    ENAME : KING
    JOB : PRESIDENT
    MGR :
    HIREDATE : 17/11/1981 00:00:00
    SAL : 5000
    COMM :
    DEPTNO : 10
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    JOB : CLERK
    MGR : 7782
    HIREDATE : 23/01/1982 00:00:00
    SAL : 1300
    COMM :
    DEPTNO : 10
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from dept where deptno = 10');
    -- Columns --
    DEPTNO - NUMBER
    DNAME - VARCHAR2
    LOC - VARCHAR2
    Row: 1
    DEPTNO : 10
    DNAME : ACCOUNTING
    LOC : NEW YORK
    PL/SQL procedure successfully completed.
    SQL>

  • 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.

  • Calling an SP takes over 200% more time over the select statement

    As part of my POC converting a SQL Server application over to SAP HANA, I'm find that CALL is taking over 200% more time than calling the SELECT statement directly. The result is that the application that uses ODBC against HANA with CALL statements is taking much more time than SQL Server. I'm finding this for all stored procedure calls in the application. Here is an example:
    CREATE PROCEDURE dbo.usp_GetOrdersByCustomerID
    (IN C_ID bigint)
    LANGUAGE SQLSCRIPT DEFAULT SCHEMA "DBO" READS SQL DATA
    AS BEGIN
    SELECT  TOP 20
       C_F_NAME,
                C_L_NAME,
                C_EMAIL,
                O_ID,
                O_TOTAL,
                O_DTS,
                O_FM_DTS
    FROM    dbo.Customer JOIN dbo.Orders ON C_ID = O_C_ID
    WHERE   C_ID = :C_ID
        ORDER   BY O_ID DESC;
    END;
    When using the following CALL statement in SAP HANA Studio
    CALL dbo.usp_GetOrdersByCustomerID(3429);
    I get execution times that look like this:
    Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'
    successfully executed in 9 ms 663 µs  (server processing time: 8 ms 115 µs)
    Fetched 5 row(s) in 0 ms 69 µs (server processing time: 0 ms 0 µs)
    Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'
    successfully executed in 11 ms 851 µs (server processing time: 8 ms 238 µs)
    Fetched 5 row(s) in 0 ms 62 µs (server processing time: 0 ms 0 µs)
    Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'
    successfully executed in 8 ms 522 µs  (server processing time: 6 ms 892 µs)
    Fetched 5 row(s) in 0 ms 93 µs (server processing time: 0 ms 0 µs)
    When I execute the select statement with the hard coded parameter value, I get much faster results:
    Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'
    successfully executed in 4 ms 430 µs  (server processing time: 2 ms 424 µs)
    Fetched 5 row(s) in 0 ms 73 µs (server processing time: 0 ms 0 µs)
    Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'
    successfully executed in 4 ms 105 µs  (server processing time: 2 ms 210 µs)
    Fetched 5 row(s) in 0 ms 69 µs (server processing time: 0 ms 0 µs)
    Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'
    successfully executed in 4 ms 694 µs  (server processing time: 2 ms 810 µs)
    Fetched 5 row(s) in 0 ms 60 µs (server processing time: 0 ms 0 µs)
    I have 500,000 rows in the Customers table and 2,500,000 rows in the Orders table. The tables are COLUMN tables.
    Is there an optimization that I'm missing?
    Regards,
    Bill

    Hi Bill,
    Can you please try something:
    tab_cust =
    SELECT
       C_F_NAME,
                C_L_NAME,
                C_EMAIL
    FROM    dbo.Customer
    WHERE   C_ID = :C_ID;
    tab_orders =
    SELECT
                O_ID,
                O_TOTAL,
                O_DTS,
                O_FM_DTS
    FROM    dbo.Orders ON C_ID = O_C_ID
    WHERE   O_C_ID = :C_ID
    SELECT  TOP 20
       C_F_NAME,
                C_L_NAME,
                C_EMAIL,
                O_ID,
                O_TOTAL,
                O_DTS,
                O_FM_DTS
    FROM    :tab_cust JOIN :tab_orders ON C_ID = O_C_ID
        ORDER   BY O_ID DESC;
    END;
    Expected behavior: The data set for each of the tables is filtered out and then joined. Although the filter is expected to be pushed to each of the joined tables even in your case, but this is worth the try.
    Regards,
    Ravi

  • Can call a function in the select statement?

    Is there any ways to call a function in the select statement?
    what I like to do is this:
    select deptno, totalEmployees(deptno), TotalSalary(deptno)
    from emp;
    I know it can be done by count(*) and join tables, but my case
    is much more complex and the where clauses are different from
    one function to another, and have many tables to join and many
    combinations
    Thanks

    Functions can be used in a select statement subject to certain
    restrictions, see
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/
    server.817/a85397/statem9b.htm#2062024
    It's under "CREATE FUNCTION> Keywords and Parameters> function>
    Restrictions on User-Defined Functions"
    Here is an except...
    When a function is called from within a query or DML statement,
    the function cannot:
    a) Have OUT or IN OUT parameters
    b) Commit or roll back the current transaction, create or roll
    back to a savepoint, or alter the session or the system. DDL
    statements implicitly commit the current transaction, so a user-
    defined function cannot execute any DDL statements.
    c) Write to the database, if the function is being called from a
    SELECT statement. However, a function called from a subquery in
    a DML statement can write to the database.
    d) Write to the same table that is being modified by the
    statement from which the function is called, if the function is
    called from a DML statement.
    Except for the restriction on OUT and IN OUT parameters, Oracle
    enforces these restrictions not only for the function called
    directly from the SQL statement, but also for any functions that
    function calls, and on any functions called from the SQL
    statements executed by that function or any function it calls.

  • Joins And For all Enteries in Select Statement

    Could you please tell me when there is a high amount of data which is being handled in the table, does the use of INNER JOINS and FOR ALL ENTERIES in SELECT Statement decreases the system performance? ?
    Can you also let me know where can i get some tips regarding do's and dont's for ABAP Programming, I want to increase my system performance.
    Currently the programs which are being used are taking a lot of time for execution...
    Its very URGENT!

    Hai Jyotsna
    Go through the following Tips for improving Performence
    For all entries
    The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
    The plus
    Large amount of data
    Mixing processing and reading of data
    Fast internal reprocessing of data
    Fast
    The Minus
    Difficult to program/understand
    Memory could be critical (use FREE or PACKAGE size)
    Some steps that might make FOR ALL ENTRIES more efficient:
    Removing duplicates from the driver table
    Sorting the driver table
    If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:
                   FOR ALL ENTRIES IN i_tab
                      WHERE mykey >= i_tab-low and
                 mykey <= i_tab-high.
    Nested selects
    The plus:
    Small amount of data
    Mixing processing and reading of data
    Easy to code - and understand
    The minus:
    Large amount of data
    when mixed processing isn’t needed
    Performance killer no. 1
    Select using JOINS
    The plus
    Very large amount of data
    Similar to Nested selects - when the accesses are planned by the programmer
    In some cases the fastest
    Not so memory critical
    The minus
    Very difficult to program/understand
    Mixing processing and reading of data not possible
    Use the selection criteria
    SELECT * FROM SBOOK.                   
      CHECK: SBOOK-CARRID = 'LH' AND       
                      SBOOK-CONNID = '0400'.        
    ENDSELECT.                             
    SELECT * FROM SBOOK                     
      WHERE CARRID = 'LH' AND               
            CONNID = '0400'.                
    ENDSELECT.                              
    Use the aggregated functions
    C4A = '000'.              
    SELECT * FROM T100        
      WHERE SPRSL = 'D' AND   
            ARBGB = '00'.     
      CHECK: T100-MSGNR > C4A.
      C4A = T100-MSGNR.       
    ENDSELECT.                
    SELECT MAX( MSGNR ) FROM T100 INTO C4A 
    WHERE SPRSL = 'D' AND                
           ARBGB = '00'.                  
    Select with view
    SELECT * FROM DD01L                    
      WHERE DOMNAME LIKE 'CHAR%'           
            AND AS4LOCAL = 'A'.            
      SELECT SINGLE * FROM DD01T           
        WHERE   DOMNAME    = DD01L-DOMNAME 
            AND AS4LOCAL   = 'A'           
            AND AS4VERS    = DD01L-AS4VERS 
            AND DDLANGUAGE = SY-LANGU.     
    ENDSELECT.                             
    SELECT * FROM DD01V                    
    WHERE DOMNAME LIKE 'CHAR%'           
           AND DDLANGUAGE = SY-LANGU.     
    ENDSELECT.                             
    Select with index support
    SELECT * FROM T100            
    WHERE     ARBGB = '00'      
           AND MSGNR = '999'.    
    ENDSELECT.                    
    SELECT * FROM T002.             
      SELECT * FROM T100            
        WHERE     SPRSL = T002-SPRAS
              AND ARBGB = '00'      
              AND MSGNR = '999'.    
      ENDSELECT.                    
    ENDSELECT.                      
    Select … Into table
    REFRESH X006.                 
    SELECT * FROM T006 INTO X006. 
      APPEND X006.                
    ENDSELECT
    SELECT * FROM T006 INTO TABLE X006.
    Select with selection list
    SELECT * FROM DD01L              
      WHERE DOMNAME LIKE 'CHAR%'     
            AND AS4LOCAL = 'A'.      
    ENDSELECT
    SELECT DOMNAME FROM DD01L    
    INTO DD01L-DOMNAME         
    WHERE DOMNAME LIKE 'CHAR%' 
           AND AS4LOCAL = 'A'.  
    ENDSELECT
    Key access to multiple lines
    LOOP AT TAB.          
    CHECK TAB-K = KVAL. 
    ENDLOOP.              
    LOOP AT TAB WHERE K = KVAL.     
    ENDLOOP.                        
    Copying internal tables
    REFRESH TAB_DEST.              
    LOOP AT TAB_SRC INTO TAB_DEST. 
      APPEND TAB_DEST.             
    ENDLOOP.                       
    TAB_DEST[] = TAB_SRC[].
    Modifying a set of lines
    LOOP AT TAB.             
      IF TAB-FLAG IS INITIAL.
        TAB-FLAG = 'X'.      
      ENDIF.                 
      MODIFY TAB.            
    ENDLOOP.                 
    TAB-FLAG = 'X'.                  
    MODIFY TAB TRANSPORTING FLAG     
               WHERE FLAG IS INITIAL.
    Deleting a sequence of lines
    DO 101 TIMES.               
      DELETE TAB_DEST INDEX 450.
    ENDDO.                      
    DELETE TAB_DEST FROM 450 TO 550.
    Linear search vs. binary
    READ TABLE TAB WITH KEY K = 'X'.
    READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.
    Comparison of internal tables
    DESCRIBE TABLE: TAB1 LINES L1,      
                    TAB2 LINES L2.      
    IF L1 <> L2.                        
      TAB_DIFFERENT = 'X'.              
    ELSE.                               
      TAB_DIFFERENT = SPACE.            
    LOOP
    AT TAB1.                     
        READ TABLE TAB2 INDEX SY-TABIX. 
        IF TAB1 <> TAB2.                
          TAB_DIFFERENT = 'X'. EXIT.    
        ENDIF.                          
      ENDLOOP.                          
    ENDIF.                              
    IF TAB_DIFFERENT = SPACE.           
    ENDIF.                              
    IF TAB1[] = TAB2[].  
    ENDIF.               
    Modify selected components
    LOOP AT TAB.           
    TAB-DATE = SY-DATUM. 
    MODIFY TAB.          
    ENDLOOP.               
    WA-DATE = SY-DATUM.                    
    LOOP AT TAB.                           
    MODIFY TAB FROM WA TRANSPORTING DATE.
    ENDLOOP.                               
    Appending two internal tables
    LOOP AT TAB_SRC.              
      APPEND TAB_SRC TO TAB_DEST. 
    ENDLOOP
    APPEND LINES OF TAB_SRC TO TAB_DEST.
    Deleting a set of lines
    LOOP AT TAB_DEST WHERE K = KVAL. 
      DELETE TAB_DEST.               
    ENDLOOP
    DELETE TAB_DEST WHERE K = KVAL.
    Tools available in SAP to pin-point a performance problem
    ·                The runtime analysis (SE30)
    ·                SQL Trace (ST05)
    ·                Tips and Tricks tool
    ·                The performance database
    Optimizing the load of the database
    Using table buffering
    Using buffered tables improves the performance considerably. Note that in some cases a statement can not be used with a buffered table, so when using these statements the buffer will be bypassed. These statements are:
    Select DISTINCT
    ORDER BY / GROUP BY / HAVING clause
    Any WHERE clause that contains a sub query or IS NULL expression
    JOIN s
    A SELECT... FOR UPDATE
    If you wan t to explicitly bypass the buffer, use the BYPASS BUFFER addition to the SELECT clause.
    Use the ABAP SORT Clause Instead of ORDER BY
    The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The database server will usually be the bottleneck, so sometimes it is better to move the sort from the database server to the application server.
    If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT statement to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the database server sort it.
    Avoid the SELECT DISTINCT Statement
    As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplicate rows.
    Thanks & regards
    Sreenivasulu P

  • 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.

  • 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

Maybe you are looking for

  • Jdeveloper JSF: works on integrated weblogic but not on remote weblogic

    I have a simple JSF application (just printing Hello World). When I deploy it through Jdeveloper to the integrated weblogic server it works fine. However, it fails to deploy to a remote standalone weblogic server it fails with this error in the logs

  • HT201287 How do I share contact info over SMS while viewing a contact?

    I am using iPhone 5S. While viewing a contact information, I would like to send the contcat info over SMS. As per user guide, if I click on Share Contact and then select Message, New Message screen is popped up but without the contact info. Need some

  • Webdynpro Notifications are not displayed

    Hi all, In webdypro for JAVA, notifications are not getting displayed.I am using  NW 7.0 Ehp2. Could anybody help me in resolving this issue. Thnks in advance Anitha

  • BAPI/Pointers on merging multiple sales orders

    Hello Gurus, I have a requirement to create a sales order with reference to multiple orders. I have used BAPI_SALESDOCUMENT_COPY to create the first order with reference to the original order, saved this order and then modify this order with the data

  • GUI for Java configuration

    Hi, SAP Applicationserver is win 2003. I'm using Ubuntu 9.10, my SAP GUI (7.0). on the same Network is runing with this configuration: conn=/H/(IP_Address_server_SAP)/S/32(system_number). How can I configure it if I'm not on the same Network ( I use