4096 character limit on single SELECT statement?

Hi,
Is there a limit on the length of SQL statements that Oracle can handle?
I am using java Statement class to execute an sql query.
I always get correct result set as long as my query stays under 4096 characters.
But if my sql query is longer than 4096, then the ResultSet is empty.
Note that there are no exceptions being thrown by executeQuery when this happens, just an empty set gets returned.
String sql = "SELECT FROM ... very long IN clause";
java.sql.Statement stmt = DBUtilities.getConnection(txn).createStatement();
ResultSet set = stmt.executeQuery(sql);

I'm not sure this is the case for this person but I want to report something I just found.   I was using sqlplus with the commands and the query in a @ file (this person is feeding an sql command to an oracle db and wants to process the return with a java program).   I knew the query was good because I had used it many time in many different situations (as an ssis input, running it on sql developer, etc).   But I was constantly getting sql parsing error on my query input so I thought I had reached this 4096 byte query that people were talking about.   Then I tripped upon the solution which may help other people.   I was using windows notepad as the editor and I made absolutely sure there were no trailing blanks (they are not visible, you have to use the arrow keys to see if there are trailing blanks) on any of the query lines (didn't really check the set lines and other sqlplus commands) in the this @command file and all of the sudden it started working the way I wanted.  I think this might help some people.

Similar Messages

  • HOW CAN I  USE MULTIPLE INNERJOINS IN A SINGLE SELECT STATEMENT?

    HI,
    I AM SHABEER AHMED,
    I AM GETTING AN ERROR WHILE I ATTEMPT TO EXECUTE A SELECT STATEMENT WITH MULTIPLE INNER JOINS . BECOZ I WANT TO FETCH ITEM DATA, PARTNER DATA  BASED ON HEADER DATA .
    THEN OF COURSE I HAVE FETCH DATA FROM VBAK VBAP VBKD SO LZ SEND ME THE SOLUTION.
    BYE

    Hi,
    1.Just see this:
    SELECT * INTO CORRESPONDING FIELD OF TABLE itab
    FROM t1 INNER JOIN t2 ON t1f4 EQ t2f4
    INNER JOIN t3 ON t2f5 EQ t3f5 AND
    t2f6 EQ t3f6 AND
    t2f7 EQ t3f7.
    2.But better to use for all entries.It increases the performance.
    FOR ALL ENTRIES
    Tabular Conditions
    The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
    SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
    <cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
    The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
    You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
    Example for ALL ENTRIES
    DATA: TAB_SPFLI TYPE TABLE OF SPFLI,
    TAB_SFLIGHT TYPE SORTED TABLE OF SFLIGHT
    WITH UNIQUE KEY TABLE LINE,
    WA LIKE LINE OF TAB_SFLIGHT.
    SELECT CARRID CONNID
    INTO CORRESPONDING FIELDS OF TABLE TAB_SPFLI
    FROM SPFLI
    WHERE CITYFROM = 'NEW YORK'.
    SELECT CARRID CONNID FLDATE
    INTO CORRESPONDING FIELDS OF TABLE TAB_SFLIGHT
    FROM SFLIGHT
    FOR ALL ENTRIES IN TAB_SPFLI
    WHERE CARRID = TAB_SPFLI-CARRID AND
    CONNID = TAB_SPFLI-CONNID.
    LOOP AT TAB_SFLIGHT INTO WA.
    AT NEW CONNID.
    WRITE: / WA-CARRID, WA-CONNID.
    ENDAT.
    WRITE: / WA-FLDATE.
    ENDLOOP.
    INNER JOINS
    In a relational database, you normally need to read data simultaneously from more than one database table into an application program. You can read from more than one table in a single SELECT statement, such that the data in the tables all has to meet the same conditions, using the following join expression:
    SELECT...
    FROM <tab> INNER JOIN <dbtab> AS <alias> ON <cond> <options>
    where <dbtab> is a single database table and <tab> is either a table or another join expression. The database tables can be specified statically or dynamically as described above. You may also use aliases. You can enclose each join expression in parentheses. The INNER addition is optional.
    A join expression links each line of <tab> with the lines in <dbtab> that meet the condition <cond>. This means that there is always one or more lines from the right-hand table that is linked to each line from the left-hand table by the join. If <dbtab> does not contain any lines that meet the condition <cond>, the line from <tab> is not included in the selection.
    The syntax of the <cond> condition is like that of the WHERE clause, although individual comparisons can only be linked using AND. Furthermore, each comparison must contain a column from the right-hand table <dbtab>. It does not matter on which side of the comparison it occurs. For the column names in the comparison, you can use the same names that occur in the SELECT clause, to differentiate columns from different database tables that have the same names.
    The comparisons in the condition <cond> can appear in the WHERE clause instead of the ON clause, since both clauses are applied equally to the temporary table containing all of the lines resulting from the join. However, each join must contain at least one comparison in the condition <cond>.
    Example for INNER JOINS
    REPORT demo_select_inner_join.
    DATA: BEGIN OF wa,
    carrid TYPE spfli-carrid,
    connid TYPE spfli-connid,
    fldate TYPE sflight-fldate,
    bookid TYPE sbook-bookid,
    END OF wa,
    itab LIKE SORTED TABLE OF wa
    WITH UNIQUE KEY carrid connid fldate bookid.
    SELECT pcarrid pconnid ffldate bbookid
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM ( ( spfli AS p
    INNER JOIN sflight AS f ON pcarrid = fcarrid AND
    pconnid = fconnid )
    INNER JOIN sbook AS b ON bcarrid = fcarrid AND
    bconnid = fconnid AND
    bfldate = ffldate )
    WHERE p~cityfrom = 'FRANKFURT' AND
    p~cityto = 'NEW YORK' AND
    fseatsmax > fseatsocc.
    LOOP AT itab INTO wa.
    AT NEW fldate.
    WRITE: / wa-carrid, wa-connid, wa-fldate.
    ENDAT.
    WRITE / wa-bookid.
    ENDLOOP.
    Regards,
    Shiva Kumar(Reward if helpful).

  • Need to write with single select statement

    NAME
    SAL
    GENDER
    X    10000    M
    X    9000    F
    Y    8000    M
    Y    7000    M
    Z    6000    F
    Z    5000    F
    A    4000    M
    A    4000    F
    1) How to write a query that displays the name that exist in both male and female gender. using single select statement
    I tried this one
    SELECT NAME FROM EMPL WHERE NAME IN (SELECT NAME FROM EMPL WHERE GENDER='F') AND GENDER='M';
    It worked fine
    But when i converted to single select statement it didn't work . You can find the query below. can i rewrite in any possible ways(using single select statement).
    Select name from table_name where gender='M' and gender='F'
    thanks in advance

    If a Name does not exist with same gender
    i.e
    Name     Gender
    X              M
    X              M    
    if above sceniorio not exist in ur data than following query will work
    select name from table_name
    group by name
    having count(name) > 1

  • Limit rows in select statement

    Hi,
    we have the following SQL select statement in an extension in our CMS system
    var newConn = new openConnection();
    if(request.searchBox)
         var searchBox = request.searchBox;
         var keywords = searchBox.split(' ')
         var sql = 'SELECT forumID, masterID, subject, message, datePosted FROM THREADS WHERE approved=1'
         for(var i=0; i<keywords.length; i++)
              sql += ' AND UPPER(subject) LIKE UPPER(\'%' + keywords[i] + '%\')'
              sql += ' OR UPPER(message) LIKE UPPER(\'%' + keywords[i] + '%\')'
         sql          += ' ORDER BY datePosted DESC;';
    else {
         document.write("No results found");
    var result = newConn.execute(sql);
    var counter = 0;
    while(result && (counter < 5 || request.searchBox))
         ascii_nextCol(result[0]);                                             //Datafield 0 Forum ID
         ascii_nextCol(result[1]);                                             //Datafield 1 Master ID
         ascii_nextCol(result[2]);                                             //Datafield 2 Subject
         ascii_nextCol(result[3]);                                             //Datafield 3 Message
         ascii_nextCol(dateFormatter.format(result[4]));                    //Datafield 4 Date posted     
         ascii_nextRow();
         result = newConn.nextRow();
         counter++;
    closeConnection(newConn);
    ascii_update();
    There are a couple of issues with it though, this bit doesn't work when no results are returned:
    else {
         document.write("No results found");
    And I want to limit the number of rows to 50.
    Someone mentioned that "ROWCOUNT" could be the answer to both problems but I have no idea where it should go or how to write it into this code. I've tried Googling for an answer without much luck as I don't know a great deal about this coding.
    Can anyone help?

    Aga wrote:
    Try adding
    sql += ' AND rownum < 51'
    before
    sql += ' ORDER BY datePosted DESC;';
    It will limit the number of rows to 50.If you limit by rownum and order in the same query you are ordering 50 random rows of the query.
    you should order in a subquery before using rownum to get only the top results.
    Processing ...
    with t as (
         select 120 as val from dual
         union all
         select -5 as val from dual
         union all
         select 45 as val from dual
         union all
         select 3 as val from dual
         union all
         select 1258 as val from dual
         union all
         select 874552 as val from dual
         union all
         select -1452 as val from dual
         union all
         select 0 as val from dual
    select *
    from t
    where rownum <= 3
    order by val
    Query finished, retrieving results...
                      VAL                 
                                        -5
                                        45
                                       120
    3 row(s) retrieved
    Processing ...
    with t as (
         select 120 as val from dual
         union all
         select -5 as val from dual
         union all
         select 45 as val from dual
         union all
         select 3 as val from dual
         union all
         select 1258 as val from dual
         union all
         select 874552 as val from dual
         union all
         select -1452 as val from dual
         union all
         select 0 as val from dual
    select *
    from (
              select *
              from t
              order by val
    where rownum <= 3
    Query finished, retrieving results...
                      VAL                 
                                     -1452
                                        -5
                                         0
    3 row(s) retrievedBye Alessandro

  • How to increment variable value in single select statement

    Hi guys
    in this select statement i have hard coded date value but i need to put variable instead of hard coded date and then i want to increment that variable value till sysdate.. i have tried using curser , type tables but they are very very slow .. any experiance guys can give me good hint what should i use.
    my query
    select
    start_dt,
    end_dt,
    hi_start_dt,
    hi_end_dt,
    ph_start_dt,
    ph_end_dt,
    h_start_date,
    h_end_date,
    g_code,
    emp_det.ref,
    u_code,
    costing,
    emp_nm,
    emp_no
    from
    emp_det,
    emp_ph_det,
    emp_hi_det,
    emp_h_det
    where
    emp_det.ref(+) = emp_ph_det.ref
    and emp_hi_det.p_ref(+) = emp_ph_det.p_ref
    and emp_h_det.ph_ref = emp_ph_det.ph_ref
    and emp_h_det.ph_st_dt(+) = emp_hi_det.st_date;
    and to_date('01-MAR-2008') between i.start_dt and nvl(i.end_dt, to_date('01-MAR-2008') +1)
    and to_date('01-MAR-2008') between i.hi_start_dt and nvl(i.hi_end_dt, to_date('01-MAR-2008') + 1)
    and to_date('01-MAR-2008') between i.ph_start_dt and nvl(i.ph_end_dt, to_date('01-MAR-2008') + 1)
    and to_date('01-MAR-2008') between i.h_start_date and nvl(i.h_end_date, to_date('01-MAR-2008') + 1)
    or
    (----emp has left this month
    i.start_dt < i.emp_end_dt
    and i.end_dt between add_months(to_date('01-MAR-2008'), -1) + 1 and to_date('01-MAR-2008')
    and i.hi_start_dt < i.hi_end_dt
    and i.hi between add_months(to_date('01-MAR-2008'), -1) + 1 and to_date('01-MAR-2008')
    and i.ph_start_dt < i.ph_end_dt
    and i.ph_end_dt between add_months(to_date('01-MAR-2008'), -1) + 1 and to_date('01-MAR-2008')
    and i.h_start_date < i.h_end_date
    and i.h_end_date between add_months(to_date('01-MAR-2008'), -1) + 1 and to_date('01-MAR-2008')

    Hi Anurag
    Thanks for the reply.please find my sample data below . below i am only showing data for one employee only.. i want to write a query where i will query for a month like march 2008 and then i need to find out the record for employe where this month march 2008 is between all the start and end dates like it should be between start_dt and end_dt and h_start_date and h_end_date and hi_strt_dt and hi_end_dt and ph_start_dt and ph_end_dt and where all the combination are true show me that record only .. i don't want any other record.
    h_start h_end_
    start_dt      end_dt     date        date          histrt_dt hi_end_dt ph_start_dt ph_end_dt
    1-Sep-07     31-Dec-08     8-Feb-08     31-Aug-08     1-Sep-07     31-Dec-07     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     1-Sep-07     31-Dec-07     1-Sep-07     31-Dec-07     1-Sep-07     31-Dec-07
    1-Sep-07     31-Dec-08     1-Sep-08     31-Dec-08     1-Sep-07     31-Dec-07     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     8-Feb-08     31-Aug-08     1-Aug-08     31-Aug-08     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     1-Sep-07     31-Dec-07     1-Aug-08     31-Aug-08     1-Sep-07     31-Dec-07
    1-Sep-07     31-Dec-08     1-Sep-08     31-Dec-08     1-Aug-08     31-Aug-08     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     8-Feb-08     31-Aug-08     1-Oct-08     31-Dec-08     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     1-Sep-07     31-Dec-07     1-Oct-08     31-Dec-08     1-Sep-07     31-Dec-07
    1-Sep-07     31-Dec-08     1-Sep-08     31-Dec-08     1-Oct-08     31-Dec-08     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     8-Feb-08     31-Aug-08     1-Sep-08     30-Sep-08     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     1-Sep-07     31-Dec-07     1-Sep-08     30-Sep-08     1-Sep-07     31-Dec-07
    1-Sep-07     31-Dec-08     1-Sep-08     31-Dec-08     1-Sep-08     30-Sep-08     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     8-Feb-08     31-Aug-08     8-Feb-08     31-Jul-08     8-Feb-08     31-Dec-08
    1-Sep-07     31-Dec-08     1-Sep-07     31-Dec-07     8-Feb-08     31-Jul-08     1-Sep-07     31-Dec-07
    1-Sep-07     31-Dec-08     1-Sep-08     31-Dec-08     8-Feb-08     31-Jul-08     8-Feb-08     31-Dec-08

  • Limit on Joined Tables or DB Links Used in a single Select Statement???

    I am writing a query that joins upwards of five tables utilizing two or three DB links in the process. When I run the query I get an error telling me that the table or view does not exist. I know that it does in fact exist and I am able to run a separate query on said table even across a DB Link. I've never know there to be a limit to the amount of DB Links used within a single query, but then again, I previously have only written in T-SQL.
    I am using ANSI standard SQL in my joins syntax and am familial with the syntax for use of remote DB tables in PL/SQL.
    Does anyone have an idea what the problem might be?
    David

    I am Using Oracle 10g and I'm positive that I am not exceeding my OPEN_LINKS limit.
    As far as my SQL, here is a simplified version:
    SELECT count(*)
    FROM SYSADM.PS_PERSONAL_DATA
    INNER JOIN ARTEMIS.HRMS_EMPLOYMENT_TBL@prod ON ARTEMIS.HRMS_EMPLOYMENT_TBL.EMPLOYEE_ID = SYSADM.PS_PERSONAL_DATA.EMPLID
    INNER JOIN ARTEMIS.HRMS_JOB_TBL@prod on ARTEMIS.HRMS_JOB_TBL.EMPLOYEE_ID = ARTEMIS.HRMS_EMPLOYMENT_TBL.EMPLOYEE_ID
    INNER JOIN SYSADM.PS_DEPT_TBL on ARTEMIS.HRMS_JOB_TBL.JOB_DEPT_ID = SYSADM.PS_DEPT_TBL.DEPTID
    INNER JOIN UMSSECU.PERSON@sirs ON ARTEMIS.HRMS_JOB_TBL.EMPLOYEE_ID = UMSSECU.PERSON.PERSON_ID
    INNER JOIN UMSSECU.ASSIGNMENT@sirs ON UMSSECU.PERSON.PERSON_ID = UMSSECU.ASSIGNMENT.PERSON_ID
    INNER JOIN UMSSECU.ORGANIZATION@sirs ON UMSSECU.ASSIGNMENT.ORGANIZATION_ID = UMSSECU.ORGANIZATION.ORGANIZATION_ID;
    The error comes into play with the join to UMSSECU.ASSIGNMENT@sirs it says that the table does not exist. But when I run (select count(*) from UMSSECU.ASSIGNMENT@sirs) on the sirs DB it executes without error. I am confused. I also just identified that I cannot remotely query that table in particular. All the other tables from the sirs DB can be queried from the other DB.

  • ABAP Joins or Separate select statements?

    Hi,
       I am working on a simulation of an implementation project as part of my in-house training programme. I am a rookie to ABAP and am now doing a print program that requires master data selection from tables ANLZ, LFA1, MSEG and CSKT, and also related line items from ANLA.
      As a former Java/.NET programmer I used to play with database joins. Now since ABAP joins are much simpler to use, I take the best advantage of them. For instance, in this particular program, I fetched related data from ANLZ, ANLA, LFA1 and CSKT into one internal table using a single select statement with ABAP joins.
      Now I happen to hear (in bits and pieces) that one should limit the use of nested joins to a certain extend. Instead, for the above program, I was advised to use 4 internal tables and to select data separately using FOR ALL ENTRIES. But in this case, we need to use 4 select statements, which means 4 database operations in place of just one.
      From ABAP documentation, I read that we can link upto 24 tables in a single select statement using ABAP joins.
    Can anyone clarify more about this? Which is high on performance?
    Using a single select statement using joins
    or
    Using multiple selects -- FOR ALL ENTRIES?
    Thanks and regards,
    Arun

    Hi Arun,
    you keep reading in these forums that FOR ALL ENTRIES is more performant, but this is simply not true.
    In your example, joining four tables for one DB operation is better than storing a lot of redundant data in internal tables just to perform four separate DB operations using FOR ALL ENTRIES.
    Make sure you join the tables correctly, i.e. link dependent tables giving their full primary key.
    FOR ALL ENTRIES can be used where effective join statements are not possible, e.g. when cluster tables are involved (like BSEG).
    Cheers
    Thomas
    Edit: check this out too: Inner Join or For All Entries

  • Selecting data from Multiple Partitions in a single select stmt.

    Hi all,
    My Database is very large & my tables are partitioned.
    My question is:
    1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
    If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
    (Note:I dont want to make use of Union concept, i want to do it in a single select statement)
    For ex:
    qry1.sql:
    select empno from emp_trans partition (P012000)
    This above query(qry1.sql) will work fine.
    qry2.sql:
    select empno from emp_trans partition (P012000,P022000)
    The above query(qry2.sql) will return will return the following error:
    ORA-00933: SQL command not properly ended
    If anybody has any solution for this, pls mail me immediately.
    Thanks in advance
    bye
    null

    All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
    Thaks for ur reply
    Bye
    null

  • Executing a stored procedure containing multiple Select statements

    Post Author: Beverly
    CA Forum: General
    I am using Crystal  10.0 against a MS SQL 2000 server.
    I am trying to create a report based on a stored procedure that contains multiple select statements.  The sp requires a single parameter (Claim number) and contains 17 Select statements that produce results.
    I am able to use the Add command and execute the sp with the parameter, but I am only getting the results of the first select statement in the sp back in my data set.  Is there a way to have the data from each Select statement returned to my report?
    I have used Crystal for a while, but pretty much for straight-forward reporting.  I am familiar with the basics of SQL.
    I would appreciate any help anyone can offer.
    Thanks.

    Post Author: BISoftware
    CA Forum: General
    I believe Crystal Reports can only handle one recordset at a time, which means it can only handle a single select statement.  The only way I can see around this would be to break up your stored procedure into multiple stored procedures, so that each only contains a single select statement.  Then, use subreports to report on each individual sp. Hope this helps. - Davewww.BusinessSoftwareResource.com

  • Case or decode in select statement for comparison

    Hi,
    How can I do a comparison
    like
    if sal < 50, output 1.1 * comm
    if sal > 50 and < = 100 output 1.2 * comm
    else output comm
    in a single select statement.
    I tried using case and decode but I am not sure how to use it in comparison operations.
    Please help

    use the 'case' construct:
    SELECT
    NORMAL_FIELD
    , (CASE
    WHEN (SAL < 50) THEN 1.1 * COMM          
    WHEN (SAL > 50) AND (SAL <= 100) THEN 1.2 * COMM
    ELSE COMM                    
    END
    ) AS CALCULATED_COMM
    FROM
    TB_xxxx
    WHERE xxxx
    hope this helps

  • Internal table -Select statement -2nd plant is not being filled

    Hi,
    Second field for plant WERKD is not getting filled in this table.I am using into corresponding fields of table ITAB statement.
    I need both plants and in single select statement.
    Any ideas?
    DATA: BEGIN OF T_STOF OCCURS 0,
        VBELN LIKE LIPS-VBELN,
        ERNAM LIKE LIPS-ERNAM,
        WERKS LIKE LIPS-WERKS,
        NTGEW LIKE LIPS-NTGEW,
        GEWEI LIKE LIPS-GEWEI,
        EBELN LIKE EKKO-EBELN,
        WERKD LIKE EKPO-WERKS,
        LGORT LIKE EKPO-LGORT,
        EBELP LIKE EKPO-EBELP,
        MATNR LIKE EKPO-MATNR,
        TXZ01 LIKE EKPO-TXZ01,
        AEDAT LIKE EKPO-AEDAT,
        KNUMV LIKE EKKO-KNUMV,
        END OF T_STOF.
      SELECT  LIKPVBELN LIKPERNAM LIPSWERKS LIPSNTGEW LIPS~GEWEI
      EKKOEBELN EKPOWERKS EKPOLGORT EKPOEBELP EKPOMATNR EKPOTXZ01 EKPOAEDAT EKKOKNUMV
      INTO CORRESPONDING FIELDS OF TABLE T_STOF
      FROM LIKP
      INNER JOIN LIPS
      ON LIKPVBELN EQ LIPSVBELN
      INNER JOIN EKKO
      ON LIPSVGBEL EQ EKKOEBELN
      INNER JOIN EKPO
      ON EKKOEBELN EQ EKPOEBELN
      WHERE LIKP~VBELN IN S_VBELN
      AND LIKP~ERNAM IN S_ERNAM
      AND LIPS~WERKS IN S_WERKS
      AND EKKO~EBELN IN S_EBELN
      AND EKPO~WERKS IN S_WERKD
      AND EKPO~LGORT IN S_LGORT
      AND EKPO~MATNR IN S_MATNR
      AND EKPO~AEDAT IN S_AEDAT
      AND BSART = 'UB'.
    Or am i doing in wrong?
    Regards
    Praveen

    Hi,
    If you use INTO CORRESPONDING then the fieldname in the internal table has to match the selecting field name..
    To avoid this you can use INTO TABLE...
    SELECT LIKPVBELN LIKPERNAM LIPSWERKS LIPSNTGEW LIPS~GEWEI
    EKKOEBELN EKPOWERKS EKPOLGORT EKPOEBELP EKPOMATNR EKPOTXZ01 EKPOAEDAT EKKOKNUMV
    <b>INTO TABLE T_STOF</b>
    Thanks,
    Naren

  • Time issue of select statement

    Hi friends,
       I have a doubt about select single statement in this particular statement below.
    i have the code which goes this way.
    loop at itab.
    concatenate *year *materail no * item type into dummy variable.
    select single dmbtr from bsis into itab-dmbtr where xref3 = dummy variable and belnr = itab-migodoc and gjahr = itab-mjahr and hkont = '0000123'.
    clear dummy variable.
    modify itab.
    endloop.
    the bsis table has around 4,000,000 records.
    The report when executed goes smoothly till the point where the above select statement is encountered.
    my question is does it take time to execute because of so many records ?
    If not then why dies it take a lot of time to execute a single select statement ? 
    and how can i optimise the time consumed by this select query or report. ?
    Thank you.
    Moderator message: please understand the basic concept of using primary or secondary indexes in your queries, you will sure find the missing field in your where-clause, read the sticky threads of this forum.
    Edited by: Thomas Zloch on Nov 20, 2010 5:31 PM

    Hi Vivek,
    Data volume definitely gives impact on SQL.
    Don't use sql inside the loop, it will decrease the performance.
    Year material no. and item type may have duplicate entries. filter that. It may also gives impact on performance.
    Write a single Select query.
    Instead of fetching the data at once use packet size.
    http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP4TuningChecklist
    Regards,
    Sudha
    Edited by: Sudha Rani Pathuri on Nov 20, 2010 6:42 PM
    Edited by: Sudha Rani Pathuri on Nov 20, 2010 6:48 PM
    Edited by: Sudha Rani Pathuri on Nov 20, 2010 6:51 PM

  • 2 set of conditions to use in a Single Select query in procedure

    Good day
    I have one procedure, want to use one 2 set of conditions in Where clause
    like
    where condition1 < value
    AND condition 2 > value
    AND condition 3 = value
    where condition 1 > value
    AND condition 2 < value
    AND condition 4 = value
    How we should combine in a single select statement where cluase.
    Please accept my sincere thanks first and looking your advice asap.
    Regards
    M.K.Thamaraiselvan

    Hi,
    While we use this procdure to run at that time it is not picking up any values also it is not running in it, taking very long time.What is not picking the value? Where clause is not picking the value, or
    where clause is picking the value but you are not getting the output.
    If it is you are not getting the output.
    I suggest to run the sql query individually without pl/sql and check if the records actually exist.
    Since it is taking very long time, I feel the sql query is actually being executed in the database but could be you are not getting the records (check if records actualy exist or if you are correctly passing the where clause)
    Regards
    Anurag
    PS:
    v_sql_string := 'SELECT table/viewname.colomn_name,'||v_order_by||','||v_report_line ||','||
    v_output_line||',table/viewname.check_amount'||v_from_clause||v_where_clause||' ORDER BY '||v_order_by;So you are using dynamic sql, can you add an extra line
    dbms_output.put_line(v_sql_string);
    and check what the actual query is formed by pl/sql, if you are satisified the query is correct run it through sql plus and check why oracle does not give the result. MAy be there is no records satisfiying this condition. And I am sure you meant either table or viewname in (table/viewname.colomn_name) and not something like what you posted.
    Edited by: Anurag Tibrewal on Oct 8, 2009 9:15 AM

  • 2 for all entries in a single select

    Hi all,
            I need to do 2 for all entries in a single select statement.Is there a way out?

    Hi,
    No you cant use two FOR ALL ENTRIES at a same time.
    Use either of following:-
    1. Only JOINS
    2. One JOIN and one FOR ALL ENTRIES.
    3. Use multiple queries to fill multiple internal table and then read these internal table to form a final internal table.
    Hope this solves your problem.
    Regards,
    Tarun

  • How to connect HRP1000, HRP1001, T77TP, T77SK in a SELECT STATEMENT

    Hi Abappers,
    Does anyone know how to put 4 tables in a SELECT STATEMENT? The output would
    be the Qualification name and  the proficiency.
    In my FUNCTION MODULE, I have to input first the employee number to search for the employee's skill. So what I did is to connect HRP1001 (where the SOBID = employee_no) and HRP1000 to display the qualification name. My next step is to display the proficiency name once the qualification name has been selected.
    Please share you knowledge! Thank you!

    Hi,
    Didn't my reply against your other thread give what you wanted? Anyway, I don't think you will be able to get the Proficiency text in a single SELECT statement. The Proficiency Scales are tied to the Qualification Catalog. So your next step after obtaining the employee's Qualification will be to get the catalog(QK) to which this Qual is tied. Then get the Prof Scale ID for the Qual Catalog from HRP1033. The Prof Rating for the Employee's Qual is maintained as an Additional Data in HRPAD31. For that you will have to get the key ie ADATANR from HRP1001 (B032 relationship of the Qualification) & then read the Rating from HRPAD31. You now have the Scale ID & rating and will get the Prof text for this rating from the Table T77TP. There is no need to access T77SK table. I know the approach is longwinded but that is exactly what you need to do in order to report an employee's Prof text. The code I posted
    Re: Where can I find Tables  for Infotype 24 (Skills) & 34 Subtype 3 (Awards) should be enough. If you are writing a report for a number of employees, it may be better to create Internal tables & store the Quals catalog, Scale ID & Rating texts instead of repeatedly accessing the database.
    Regards,
    Suresh Datti

Maybe you are looking for

  • BSP: How to create check box in a column of a Table View

    Hi All, I have a table view in Web IC scenario. my requirement is to display check box in one of the column of the table view.. so that i can select multiple lines from the table and do some calculations!. Anybody have any hint/clue Thanks in advance

  • 10 Ways to Enable IT Innovation in the Enterprise

    Calling all East Coast New Relic users! After a summer hiatus, New Relic User Groups are back with four big meetups in September. Read More This topic first appeared in the Spiceworks Community

  • What is the best way to install OSX and other computer files?

    Hi, Long story short my Mac OSX got rewritten over with Windows XP so have to do a fresh install. So do I do the fresh install first and then transfer over all the stuff from my sister's computer to mine via Firewire? You know when you first get a Ma

  • Upload data through flafile

    Hi . Due to some requirement, the data being loaded to the cube through portal application was restrcited to 2 digits(just in value and not by properties, that means the value is not 1.23 but 1.2300). For exmaple, Before that change, the value was 1.

  • T60 won't resume windows after standby and hibernation

    Hey guys first post this is the first thing thats gone wrong with my laptop which i can't fix myself this problem may be because of another problem but i'll tell you the symptoms and probable cause i need help with fixing it ok.... i'v got a t60 6369