Indixes and like statement

hi folx,
hmm i need to know of there is any chance
to create an index or a kind of hash table
for a column (varchar) wich needs to be compared to '%string%'. No index is usefull for me
cause to many differences for bitmap index.
normal and reverse indexes would imho
not be used by the parser.
I thought about context cartridge but varchar(80) is too small i think to get any performance back from the query.
thanks in advance
mfg
markus

Statement should be quicker than Prepared Statement, because
Statment do only one thing: send that sql to server or run that sql directly.
Prepared Statement should do two (or more than two)things:
1. parse your sql first, prepare a store procedure, then call that store procedure.
Or
2. prase your sql first, then use your value to replace "?" for getting a new sql, then work like Statement.
Prepared Statement is quiker when you use it repeatedly.

Similar Messages

  • Help with TYPE and LIKE statements

    HI guys,
    I know this is really novice stuff, but I am a little confused.
    Can anyone please explain the exact difference between TYPE and like with the help of a program, to understand it.
    What situation would demand the use of each of the LIKE statement, since I can do all these things using the TYPE ?

    Hi Akhil,
    I summarized the info in SDN posts and SAP Help, to make it easier for you to understand. I also included some code snippets. Hope these prove to be helpful to you.
    The following is from SAP Help:
    The Additions TYPE and LIKE
    The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.
    ·        Definition of local types in a program
    ·        Declaration of data objects
    ·        Dynamic creation of data objects
    ·        Specification of the type of formal parameters in subroutines
    ·        Specification of the type of formal parameters in methods
    ·        Specification of the type of field symbols
    A known data type can be any of the following:
    ·        A predefined ABAP type to which you refer using the TYPE addition
    ·        An existing local data type in the program to which you refer using the TYPE addition
    ·        The data type of a local data object in the program to which you refer using the LIKE addition
    ·        A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure compatibility with earlier releases, it is still possible to use the LIKE addition to refer to database tables and flat structures in the ABAP Dictionary. However, you should use the TYPE addition in new programs.
    The LIKE addition takes its technical attributes from a visible data object. As a rule, you can use LIKE to refer to any object that has been declared using DATA or a similar statement, and is visible in the current context.  The data object only has to have been declared. It is irrelevant whether the data object already exists in memory when you make the LIKE reference.
    ·        In principle, the local data objects in the same program are visible. As with local data types, there is a difference between local data objects in procedures and global data objects. Data objects defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program.
    ·        You can also refer to the data objects of other visible ABAP programs. These might be, for example, the visible attributes of global classes in class pools. If a global class cl_lobal has a public instance attribute or static attribute attr, you can refer to it as follows in any ABAP program:
    DATA dref TYPE REF TO cl_global.
    DATA:  f1 LIKE cl_global=>attr,
           f2 LIKE dref->attr.
    You can access the technical properties of an instance attribute using the class name and a reference variable without first having to create an object. The properties of the attributes of a class are not instance-specific and belong to the static properties of the class.
    Example
    TYPES: BEGIN OF struct,
             number_1 TYPE i,
             number_2 TYPE p DECIMALS 2,
           END OF struct.
    DATA:  wa_struct TYPE struct,
           number    LIKE wa_struct-number_2,
           date      LIKE sy-datum,
           time      TYPE t,
           text      TYPE string,
           company   TYPE s_carr_id.
    This example declares variables with reference to the internal type STRUCT in the program, a component of an existing data object wa_struct, the predefined data object SY-DATUM, the predefined ABAP type t and STRING, and the data element S_CARR_ID from the ABAP Dictionary.
    The following info is from various posts:
    --> Type: It is used when userdefined object link with SAP system data type.
    Local types mask global types that have the same names. When typing the interface parameters or field symbols, a reference is also possible to generic types ANY, ANY TABLE,INDEX TABLE, TABLE or STANDARD TABLE, SORTED TABLE and HASHED TABLE.
    --> Like: It is when data object link with the other data object.
    --> TYPE, you assign datatype directly to the data object while declaring.
    --> LIKE,you assign the datatype of another object to the declaring data object. The datatype is referenced indirectly.
    you can refer to all visible data objects at the ABAP program's positon in question. Only the declaration of the data object must be known. In this case it is totally irrelevant whether the data object already exists physically in
    memory during the LIKE reference. Local data objects mask global data objects that have the same name.
    --> Type is a keyword used to refer to a data type whereas Like is a keyword used to copy the existing properties of already existing data object.
    Types: var1(20) type c.
    data: var2 type var1. ( type is used bcoz var1 is defined with TYPES and it
    does not occupy any memory spce.
    data: var3 like var2. ( like is used here bcoz var2 is defined with DATA
    so it does occupy space in memory ).
    data: material like mara-matnr. ( like is used here bcoz mara-matnr is stored in memory)
    --> Type refers the existing data type
    --> Like refers the existing data object
    Please Reward Points if any of the above points are helpful to you.
    Regards,
    Kalyan Chakravarthy

  • Mysql select statement where = works and LIKE fails

    I am using Flash Builder 4. On the server side I use php and mysql. I created a php dataservice using FB4. My plan had been to allow users to enter a search term and query the database using a "LIKE" statement. FB4 created the php code that I simply modified changing the parameter name. The input parameter is a string.
    public function getT_caseByID($searchTerm) {
    $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title = ?)");
    $this->throwExceptionOnError();
    mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
    $this->throwExceptionOnError();
    mysqli_stmt_execute($stmt);
    $this->throwExceptionOnError();
    mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
    if(mysqli_stmt_fetch($stmt)) {
          return $row;
    } else {
          return null;
    A look at FB4 shows this code returns data.
    This code works fine but if I make the below change it fails, even when I use the wildcard %. the only change is "=" to "LIKE".
    public function getT_caseByID($searchTerm) {
    $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title LIKE ?)");
    $this->throwExceptionOnError();
    mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
    $this->throwExceptionOnError();
    mysqli_stmt_execute($stmt);
    $this->throwExceptionOnError();
    mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
    if(mysqli_stmt_fetch($stmt)) {
         return $row;
    } else {
         return null;
    A look into FB4 shows "void".
    Any help would be appreciated. I am using localhost on Apache Server on a development computer with Windows XP.

    correctio0n on the select statement
    select statement code*********
    select
        apspnr astspr aobjnr apspid
        bpsphi bposid
        caufnr cpspel
        dinact dstat
        eudate eusnam eutime "estat
       F~TXT04
        g~estat
        G~TXT04
        into corresponding fields of table itobj
        from proj as a
        inner join prps as b on apspnr = bpsphi
        inner join aufk as c on bpspnr = cpspel
        inner join jest as d on cobjnr = dobjnr
        inner join jcds as e on dobjnr = eobjnr
                             and dstat = estat
        inner join tj02t as f on estat = fistat
        inner join tj30t as g on astspr = gstsma
        for all entries in itparm
        where  apspid = itparm-pspid "or estat = itparm-psy )
        or  bposid = itparm-posid "or estat = itparm-wsy )
        or  caufnr = itparm-aufnr "or estat = itparm-nsy  )
        and ( dinact  'X' or einact  'X')
        and fspras = 'E' and gspras = 'E'.

  • Difference b/w DATA TYPE and DATA OBJECT & differences b/w TYPE and LIKE

    hai
    can any one say the differences between Data type and Data Object.
    And also differences between TYPE and LIKE
    thanks
    Gani

    hi,
    _Data Types and Data Objects_
          Programs work with local program data – that is, with byte sequences in the working memory. Byte sequences that belong together are called fields and are characterized by a length, an identity (name), and – as a further attribute – by a data type. All programming languages have a concept that describes how the contents of a field are interpreted according to the data type.
          In the ABAP type concept, fields are called data objects. Each data object is thus an instance of an abstract data type. There are separate name spaces for data objects and data types. This means that a name can be the name of a data object as well as the name of a data type simultaneously.
    Data Types
       As well as occurring as attributes of a data object, data types can also be defined independently. You can then use them later on in conjunction with a data object. The definition of a user-defined data type is based on a set of predefined elementary data types. You can define data types either locally in the declaration part of a program using the TYPESstatement) or globally in the ABAP Dictionary. You can use your own data types to declare data objects or to check the types of parameters in generic operations.
         All programming languages distinguish between various types of data with various uses, such as ….. type data for storing or displaying values and numerical data for calculations. The attributes in question are described using data types. You can define, for example, how data is stored in the repository, and how the ABAP statements work with the data.
    Data types can be divided into elementary, reference, and complex types.
    a. Elementary Types
    These are data types of fixed or variable length that are not made up of other types.
    The difference between variable length data types and fixed length data types is that the length and the memory space required by data objects of variable length data types can change dynamically during runtime, and that these data types cannot be defined irreversibly while the data object is being declared.
    Predefined and User-Defined Elementary Data Types
    You can also define your own elementary data types in ABAP using the TYPES statement. You base these on the predefined data types. This determines all of the technical attributes of the new data type. For example, you could define a data type P_2 with two decimal places, based on the predefined data type P. You could then use this new type in your data declarations.
    b.  Reference Types
    Reference types are deep data types that describe reference variables, that is, data objects that contain references. A reference variable can be defined as a component of a complex data object such as a structure or internal table as well as a single field.
    c. Complex Data Types
    Complex data types are made up of other data types. A distinction is made here between structured types and table types.
    Data Objects
          Data objects are the physical units with which ABAP statements work at runtime. The contents of a data object occupy memory space in the program. ABAP statements access these contents by addressing the name of the data object and interpret them according to the data type.. For example, statements can write the contents of data objects in lists or in the database, they can pass them to and receive them from routines, they can change them by assigning new values, and they can compare them in logical expressions.
           Each ABAP data object has a set of technical attributes, which are fully defined at all times when an ABAP program is running (field length, number of decimal places, and data type). You declare data objects either statically in the declaration part of an ABAP program (the most important statement for this is DATA), or dynamically at runtime (for example, when you call procedures). As well as fields in the memory area of the program, the program also treats literals like data objects.
            A data object is a part of the repository whose content can be addressed and interpreted by the program. All data objects must be declared in the ABAP program and are not persistent, meaning that they only exist while the program is being executed. Before you can process persistent data (such as data from a database table or from a sequential file), you must read it into data objects first. Conversely, if you want to retain the contents of a data object beyond the end of the program, you must save it in a persistent form.
    Declaring Data Objects
          Apart from the interface parameters of procedures, you declare all of the data objects in an ABAP program or procedure in its declaration part. These declarative statements establish the data type of the object, along with any missing technical attributes. This takes place before the program is actually executed. The technical attributes can then be queried while the program is running.
         The interface parameters of procedures are generated as local data objects, but only when the procedure is actually called. You can define the technical attributes of the interface parameters in the procedure itself. If you do not, they adopt the attributes of the parameters from which they receive their values.
    ABAP contains the following kinds of data objects:
    a.  Literals
    Literals are not created by declarative statements. Instead, they exist in the program source code. Like all data objects, they have fixed technical attributes (field length, number of decimal places, data type), but no name. They are therefore referred to as unnamed data objects.
    b.  Named Data Objects
    Data objects that have a name that you can use to address the ABAP program are known as named objects. These can be objects of various types, including text symbols, variables and constants.
    Text symbols are pointers to texts in the text pool of the ABAP program. When the program starts, the corresponding data objects are generated from the texts stored in the text pool. They can be addressed using the name of the text symbol.
    Variables are data objects whose contents can be changed using ABAP statements. You declare variables using the DATA, CLASS-DATA, STATICS, PARAMETERS, SELECT-OPTIONS, and RANGESstatements.
    Constants are data objects whose contents cannot be changed. You declare constants using the CONSTANTSstatement.
    c.  Anonymous Data  Objects
    Data objects that cannot be addressed using a name are known as anonymous data objects. They are created using the CREATE DATAstatement and can be addressed using reference variables.
    d.  System-Defined Data Objects
    System-defined data objects do not have to be declared explicitly - they are always available at runtime.
    e.  Interface Work Areas
    Interface work areas are special variables that serve as interfaces between programs, screens, and logical databases. You declare interface work areas using the TABLES and NODESstatements.
    What is the difference between Type and Like?
    Answer1:
    TYPE, you assign datatype directly to the data object while declaring.
    LIKE,you assign the datatype of another object to the declaring data object. The datatype is referenced indirectly.
    Answer2:
    Type is a keyword used to refer to a data type whereas Like is a keyword used to copy the existing properties of already existing data object.
    Answer3:
    type refers the existing data type
    like refers the existing data object
    reward if useful
    thanks and regards
    suma sailaja pvn

  • I was using my wifi last night when I got an error message stating my ip address had been taken over.  Then safari stopped working and i can no longer access the internet. I looked at my ip address and it states 000.000.000....can someone please help?

    I was using my wifi last night when I got an error message stating my ip address had been taken over.  Then safari stopped working and i can no longer access the internet. I looked at my ip address and it states 000.000.000....can someone please help?

    Sounds like a bogus pop up. In any case power down your Mac, your modem, your router. Then power back up in 1 minute sequence; modem, router, Mac.

  • SQL LIKE statement in JSP

    I tried to write a query in jsp page using LIKE statement. However, Apache Tomcat report back an error in the query string. I tried to run the same query style in MS Access and it works. Can someone please tell me where is the error in jsp code:
    JSP Code:
    sql = "SELECT tblStudent.firstName, tblStudent.lastName, tblStudent.studentID FROM tblStudent WHERE (((tblStudent.firstName) LIKE '%" + g_firstNameInput + "%')) ORDER BY tblStudent.firstName";
    MS Acccess:
    SELECT tblStudent.firstName, tblStudent.lastName, *
    FROM tblStudent
    WHERE (((tblStudent.firstName) Like '*e*'))
    ORDER BY tblStudent.firstName;
    PS: I tried changing from '%' to '*' already, but still does not work
    Thanks

    Don't use JSP for SQL querries... to complicated.
    1) Write a Java application that does what you want (as far as interacting with the database
    2) Isolate the database access code into its own class/classes
    3) Double check that you can then use those isolated classes inside a command line application
    4) Adapt the code you used in 3) to use those same classes from a JSP - preferrably using Java Beans and DTOs

  • Can I use a select and update statement in a single jsp file?

    I want to update the BUY table everytime I would add a SELL transaction.....I want to minus the stocks that I sold to those that Ive bought before.....
    note: I used a seperate table in BUY and SELL transaction
    After I Have added a transaction, I want to update the buy table. This is my problem, can I used both SELECT and UPDATE statement at the same time in a single jsp file for example like this:
    select * from test, test1;
    update test
    set total_shares=total_shares-Stotal;
    where stock_code=Scode AND name_broker=Sbroker;
    Can i have both of these statements in the same jsp file in oder to update the buy table?
    Or can anyone suggest how can process that update?THANKS!
    --------------------

    Can i have both of these statements in the same jsp file in oder to update the buy table?Yes. But wouldn't it have been easier just to try it?

  • SQL query editor and "like" with a parameter (can't get it to work).

    I've been following all sorts of directions on how to use mysql a table and modifying the query to accept a parameter, funny thing is no matter how I try to construct the simplest query, the query editor does not parse the query properly when using the "LIKE" statement.
    Using 3.11 and/or 3.12 of the J/connector with no success.
    I am using a query that resembles the following:
    select all table.fieldname, table.fieldname2 from tablename where table.fieldname like '%?%'
    It parses correctly but the code when run can not find the parameter as it reports the number of paramenters as being incorrect.
    I have tried these varriations of the "like" statement.
    '%?%' - expected this to work, it parses correctly but errors out claiming invalid number of parameters.
    %?% - without quotes causes parsing errors.
    '?' - parses correctly but isn't the correct query.
    ? - again without quotes causes parsing errors,even if it did it isn't the correct query.
    If I set the query to use a value instead of a parameter - it works fine.
    Hints? Suggestions? Bug?
    Thanks in advance.

    Hmm, try use
    select ... like ?
    And path this kind of string as the parameter to your query
    String findCriteria = "what you are looking for";
    String parameter = "'%" + findCriteria + "%'";Roman.

  • Not Like statement in Crystal?

    In SQL server there is a statement that goes along the lines of (field1) not like '09%'
    In Crystal Reports there is a statement "Like".  Is there any statement in Crystal that is "Not Like"?
    I'm trying to get a wildcard of 09 to work in Crystal so far I have......
    (field1) <> "09*"
    But it needs to be something like the following ........
    (field1) not like "09*"
    Does Crystal have a Not Like statement?  What are my choices if Crystal does not have that statement?
    Thanks

    I'm looking for anything that does not contain any thing like "09".  The actual "09" field is "09xx", and the report will need to pull back everything that is not "09"
    I used the * symbol to try and do a wildcard that would not pull back anything that is like "09".
    I was wondering if the * symbol was Crystal Reports answer to "Not Like"?

  • G/L account in cash and bank statement

    Dear All,
    How to fill the field GL account in the cash and bank statement ? I have press tab but still can't open the list of G/L account. Thanks
    Rgds,
    Mark

    Jimmy, tks for your wonderful and quick answer. I am using PE 680.01.70 version. It is still under my exploration if our company top management would like to use it, I think we will use. I'll be back to check your answers. if nothing well, I will unassign the points.
    CU

  • Statement and Prepared Statement

    if i write a same query with statement and preparedStatement
    like
    Select * from emp_detail where emp_id =20;
    stmt= con.createStatment();
    rs = stmt.executeQuery(query);
    and using preparedStatement
    Select * from emp_detail where emp_id =?;
    pstmt= con.prepareStatement();
    pstmt.setInt(1,20);
    rs = stmt.executeQuery(query);
    Using which statment(Statement or Prepared Statement) the data will retrive fast and why.... in these case ????

    Statement should be quicker than Prepared Statement, because
    Statment do only one thing: send that sql to server or run that sql directly.
    Prepared Statement should do two (or more than two)things:
    1. parse your sql first, prepare a store procedure, then call that store procedure.
    Or
    2. prase your sql first, then use your value to replace "?" for getting a new sql, then work like Statement.
    Prepared Statement is quiker when you use it repeatedly.

  • Method calls in switch and for statements

    I have 2 questions concerning method calls in switch and for statements. Consider these two chunks of code:
    1)
         switch (foo.getIntegerValue()){
              case 1:
              case 2:
         }My question is, is getIntegerValue() being called for every case statement (since it has to compare with each case) or is the method called only once?
    2)
    for (Foo bla : xyz.compileFoos()) {
    }Is compileFoos called once or on every iteration?
    I assume it gets called only once but I would like to be sure. The reason I ask is of course to avoid multiple method calls.
    any help is appreciated

    sdb2 wrote:
    I have 2 questions concerning method calls in switch and for statements. Consider these two chunks of code:
    1)
         switch (foo.getIntegerValue()){
              case 1:
              case 2:
         }My question is, is getIntegerValue() being called for every case statement (since it has to compare with each case) or is the method called only once?
         Once, and the value returned compared to each "case" in turn.
    2)
    for (Foo bla : xyz.compileFoos()) {
    }Is compileFoos called once or on every iteration?
    I assume it gets called only once but I would like to be sure. The reason I ask is of course to avoid multiple method calls.
    any help is appreciatedAlso once, and the returned list/set/array is iterated over.

  • Named query problem with "like" statement

    I'm having issues with a named query that contains a 'like' statement in it. I have other named queries that have like statements that have hardcoded like values in them that work fine.
    (i.e. select * from foo where foo.col1 like 'foo%' )
    But when the like value to be tested is a parameter, it doesn't seem to work at all, no matter what variation i've tried, other than no wildcards.
    (i.e.
    this DOES work
    select * from foo where foo.col1 like #fooParm
    this DOES NOT work
    select * from foo where foo.col1 like '%#fooParm%'
    Any suggestions on how to get this to work?
    Thanks in advance

    Try building your select statement in a different way.
    Instead of:
    select * from foo where foo.col1 like '%#fooParm%'
    Try something like:
    select * from foo where foo.col1 like '#fooParm'
    And include the wild cards in the parameter.
    i.e. if fooParam was 'abc', make fooParm = '%abc%'

  • Multiple like statements in a query

    Hi,
    I wonder if it's possible to have multiple like statements in a query.
    suppose instead of
    select * from someTable where remarks like '%ab%'
    I want to search for many string patterns such as '%edi%' '%odi%' '%di%' '%gf%' '%od%' '%podi%' etc. in one query.
    BTW, the table contains many millions of records.
    Regards
    Crusoe
    Edited by: Crusoe on 19-Jan-2009 00:25

    Crusoe wrote:
    This regexp_like function does not work with the development server to which I have rights to create tables etc. I guess it only works in 10g or greater. However i tried a quick test in the production server and it worked. It returned rows where the values between the | characters were found anywhere in the field ( I must learn this regex syntax sometime). Yes, regular expressions are 10g upwards. (You really should have your development server reflect your production server)
    There was a thread a while back giving an introduction to regular expressions...
    Introduction to regular expressions ...

  • Quantity in Balance Sheet/Profit and Loss statement

    Hello guys,
    in the output of the balance Sheet/Profit and Loss statement, we have total amount of the reconciliation accounts in a period
    Is there any statement which can tell us also how many movements (lines) were in each reconciliation accounts? Like hoe many movements composed the total amount?
    this would be needed for reporting period and also for comparison period
    thanks in advance for letting me know
    hana

    Dear:
                 To check recon a/c movement for vendors and customers please use FBL5N & FBL1N.
                  Regards

Maybe you are looking for

  • Plant and company code assignment in Ecc 6.0

    Hi, In 4.7 and ecc5.0 version we can assign only one company code for one plant but we can assign multiple plants to one company code. but in ecc 6.0 we can assign  multiple  company codes to one plant.  what is the main use to maintiang multiple  co

  • Import MultiPage PDF nested equally on single page

    Hello, I have had a scout around on the net but cannot find anything so far on the subject topic and I wondered if anyone here knows of its existence. I need a script that will allow me to import a multipage PDF into one large page. I need each impor

  • Late 2006 MacBook Pro and Lion

    Late 2006 MacBook Pro (2.16 Ghz Core 2 Duo w/ 3 GB RAM). I'd like to run Lion on it so I can use iCloud to sync calendars, contacts etc between it and my Mac Pro, iPad and iPhone MacBook Pro is old I know, but I'm not at the stage of being able to re

  • Unable to see external USB hard drive

    Time Capsule: 500gb Ext HDD: Toshiba 500gb 2.5" Have formatted the USB HDD as Mac OS (extended) and connected it to the USB connector at the back of the Time Capsule however the drive does not show up. If we connect the drive to any other Mac it sees

  • NULL nested object

    Hi, OTT generates code as streamOCCI_.setObject(obj); when one define a nested object (not REF) e.g CREATE TYPE inside_t (f1 NUMBER) CREATE TYPE outside_t (id NUMBER, insider inside_t) The problem I am seeing is that when I instantiate a persistent o