Find character between others

hi,
I want to find a characters that is between others character.
e.g.
This are the rows from my table
x|y|z|a|b
da|c|m|a|b
I have a variable v_var and
if v_var between | and | then
dbms_output.put_line(v_var);
end if;
Thank you

It won't work in the case where it's either first or last in the expression, where there will be no '|'.
You could simplify the condition with regular expressions as follows:
SQL> set serveroutput on
SQL> declare
  2    v_row varchar2(100) := 'da|c|mda|a|b';
  3    v_var varchar2(100) := 'DA';
  4  begin
  5    if regexp_like(v_row, '(^|\|)'|| v_var ||'(\||$)', 'i') then
  6      dbms_output.put_line('''' || v_var || ''' was found in the string ''' || v_row || '''.');
  7    end if;
  8  end;
  9  /
'DA' was found in the string 'da|c|mda|a|b'.
PL/SQL procedure successfully completed
SQL> Where the last parameter 'i' starnds for case Insensitive matching. If you omit that one it will only return exact matches with regards to upper and lower case.

Similar Messages

  • Report to Find different between PCR & Schemas

    hi guru's,
    Can Any tell me the Report to Find different between PCR & Schemas in Two Clients,(For examle from 4.7 to 6.0)
    Regards,
    Bala

    Hi Bala,
    The following link will help you.
    PCR and SCHEMAS
    Thanks & Regards,
    Sandip Biswas

  • Finding difference between 2 databases

    Hi Folks,
    I have the following problem:
    I have 2 databases, database old, database new. Database new has modified/removed/added/inserted rows. Also columns in the db can also be modified. So what I have to do is to find the set of SQL statements which if I execute on database old, will make database old same as database new. Modification is only in data, not triggers etc.,
    I have explained my manager that this is not very easy to implement. Even finding difference between 2 DB is not trivial. Do you guys have any suggestion for me? whether in terms of implementing it or even convincing my boss is fine :)
    Are there any open source tools to do this? I am in big trouble now :(
    Thanks,

    Unless there is some other goal that you have not mentioned this is fairly easy.
    Just delete all the tables from the old database using SQL delete tables and then create new tables and populate them with data from the new database.
    Your SQL is basically just a serialization of the data in your new database.
    Anything else that you could do, such as calculating the differences from the one database to the other, and then creating a minimal edit list that will make the least possible number of changes must be weighed against the time it will take to write the code to compute the differences, the time it will take to debug the code and convince yourself that it is doing the right thing, and the time it will take to actually run.

  • Cannot transliterate character between character sets problem

    i hava a database which carset is selected none before
    when i want to get data from this database i get the error
    java.sql.SQLException: [interclient][interbase]arithmetic exception, numeric overflow, or string truncation
    [interclient][interbase]Cannot transliterate character between character sets
         at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
         at interbase.interclient.ResultSet.getNextCursorPosition(Unknown Source)
         at interbase.interclient.ResultSet.next(Unknown Source)
    but i m getting the error when rs.next()
    so ican't use methods to encode when rs.getBytes.............

    i hava a database which carset is selected none
    before
    when i want to get data from this database i get the
    error
    java.sql.SQLException:
    [interclient][interbase]arithmetic exception, numeric
    overflow, or string truncation
    [interclient][interbase]Cannot transliterate
    character between character sets
    atcontact the driver vendor for support.

  • Find space between word with different endings and digit

    Hi,
    I'm trying to figure out how to find spaces between word and digit.
    I am limited to use only word 'WORD' (either capital or small caps) with different endings like -ing -s -y and more (using \S+).
    I wrote something like (?i)(?<=WORD\S+)\s(?=\d+) but this does not seem to work due to some limitation of lookahead I belive?
    Any suggestions?
    Peter

    Peter Stnsz wrote:
    … find what: (\<WORD\S+)(\s)(?=\d)
    change to: $1~s
    Hmmh?
    Your Grep do not find your first example: WORD 0,2 (WORD without any ending)
    And you don't need the second ()
    And please do not use \S
    Use this instead:
    (\<WORD\l*)\s(?=\d)
    (l is the little L)
    Have fun

  • Find character styles

    Hi,
    How to find character styles through javascript

    finding text using character style means the below code will do that...
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.appliedCharacterStyle = "char_style";//character style name
    found = app.activeDocument.findGrep (true);
    for (i = 0; i < found.length; i++){
        found[i].select();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    Vandy

  • Find difference between date

    I need to know how i can find difference between date
    like Joining date: 01-jan-2009 Today 10-jan-2010 result will be "1 year 10 days"
    I need it in Oracle forms 6i. plz help me...

    Hi,
    In oracle forms you can use
    RESULT :=
    TRUNC ((:date2 - :date1 + 1) / 365)
    || ' year and '
    || MOD (:date2 - :date1 + 1, 365)
    || ' days';
    in sql you can use
    SELECT TRUNC ((:date2 - :date1 + 1) / 365)
    || ' year and '
    || MOD (:date2 - :date1 + 1, 365)
    || ' days'
    FROM DUAL;

  • Finding Distance between two zipcodes with longtitude and latitude

    Want to find distance between two zipcodes that have their latitude and longitude stored in a table.
    The table is as follows
    CREATE TABLE distance (zipcode VARCHAR2, LNG NUMBER, LAT NUMBER)
    I couldn't come up with a calculation or understand the mathematical calculation on line.. Can you help me with some stored procedure that will do..?
    Thanks

    There is no logical complexity in your query besides knowing the basics of
    http://en.wikipedia.org/wiki/Spherical_coordinates
    Also, the table name "Distance" cannot be more confusing; what you have is essentially "PointsOnSphere".
    select R*sqrt(
    (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))* (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))
    +
    (sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))*
    (sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))
    +
    (cos(pi-p1.lng)-cos(pi-p2.lng))*(cos(pi-p1.lng)-cos(pi-p2.lng))
    from distance p1, distance p2
    where R is the radius of Earth, and pi=3. Don't forget to convert angular degrees into radiants before you plug in them into the query above
    Correction: This was euclidean distance sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2) between the points (x1,y1,z1) and (x2,y2,z2). Spherical distance is
    sqrt(
    (R*(colatitude1-colatitude2))^2+
    (R*sin(colatitude1-colatitude2)*(longtitude1-longtitude2))^2
    Message was edited by:
    Vadim Tropashko

  • Find Differences between two tables at column level

    Hi,
    I have 2 tables one live table and the other History table..
    If i have to find differences between live table and the latest version in the History table and also find which column got chaanged
    How would i do that for a table which has many columns and i need each column for which the value has changed for a id
    for ex:
      Table 1   (LIve)                           Table 2 (History)
    ID col1     col2    Version               ID       col1     col2    Version
     1   ABC     123     V1                     1       ABCD   123     v2
     2   NBS     1234   V1                     2        NBS     123     V2
    Result set should be 
    Result Set:
    ID col which changed
    1    col1
    2    col2   
    Because the values for that column had been changed
    Except gives me all the differences not just the column level ..

    The dynamic version using schema views... :D
    --Build a coulple OF testing tables to play with
    CREATE TABLE dbo.Table1 (
    ID INT IDENTITY(1,1) PRIMARY KEY,
    Col1 INT,
    Col2 INT,
    Col3 INT
    CREATE TABLE dbo.Table2 (
    ID INT IDENTITY(1,1) PRIMARY KEY,
    Col1 INT,
    Col2 INT,
    Col3 INT
    INSERT dbo.Table1 (Col1,Col2,Col3) VALUES
    (123,456,789),
    (111,222,333),
    (444,555,666),
    (777,888,999),
    (321,345,769),
    (179,753,758),
    (362,362,236),
    (856,874,896),
    (821,729,324)
    INSERT dbo.Table2 (Col1,Col2,Col3) VALUES
    (123,456,789),
    (111,999,333), --col2 diff
    (444,555,666),
    (777,888,999),
    (321,345,123), --col3 diff
    (179,753,758),
    (362,362,236),
    (234,874,896), --col1 diff
    (821,729,324)
    And then the actual solution...
    DECLARE
    @t1 VARCHAR(10) = 'Table1',
    @t2 VARCHAR(10) = 'Table2'
    IF OBJECT_ID('tempdb..#temp') IS NOT NULL DROP TABLE #temp
    SELECT
    c.TABLE_SCHEMA,
    c.TABLE_NAME,
    c.COLUMN_NAME,
    c.ORDINAL_POSITION,
    CASE WHEN u.COLUMN_NAME IS NOT NULL THEN 1 ELSE 0 END AS PK
    INTO #temp
    FROM
    INFORMATION_SCHEMA.COLUMNS c
    JOIN INFORMATION_SCHEMA.TABLES t
    ON c.TABLE_NAME = t.TABLE_NAME
    AND c.TABLE_SCHEMA = t.TABLE_SCHEMA
    LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE u
    ON c.COLUMN_NAME = u.COLUMN_NAME
    AND c.TABLE_NAME = u.TABLE_NAME
    AND c.TABLE_SCHEMA = u.TABLE_SCHEMA
    AND OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1
    WHERE 1 = 1
    AND t.TABLE_TYPE = 'BASE TABLE'
    AND c.TABLE_NAME IN (@t1,@t2)
    ORDER BY
    c.TABLE_SCHEMA, c.TABLE_NAME, c.ORDINAL_POSITION
    DECLARE @select VARCHAR(MAX)
    SELECT @select = COALESCE(@select + ', ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
    FROM #temp AS t
    ORDER BY t.TABLE_NAME, t.ORDINAL_POSITION
    DECLARE @from VARCHAR(MAX)
    SELECT @from = COALESCE(@from + ' FULL JOIN ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME
    FROM #temp AS t
    WHERE t.PK = 1
    ORDER BY t.TABLE_NAME
    DECLARE @on VARCHAR(MAX)
    SELECT @on = COALESCE(@on + ' = ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
    FROM #temp AS t
    WHERE t.PK = 1
    ORDER BY t.TABLE_NAME, t.ORDINAL_POSITION
    DECLARE @where VARCHAR(MAX)
    SELECT @where = COALESCE(@where + CASE WHEN t.TABLE_NAME = @t1 THEN ' OR ' ELSE ' <> ' END, '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
    FROM #temp AS t
    WHERE t.PK = 0
    ORDER BY t.ORDINAL_POSITION, t.TABLE_NAME
    DECLARE @sql VARCHAR(MAX) = '
    SELECT ' + @select + '
    FROM ' + @from + '
    ON ' + @on + '
    WHERE ' + @where
    EXEC (@sql)
    HTH,
    Jason

  • Find gap between two dates from table

    Hello All,
    I want to find gap between two dates ,if there is no gap between two dates then it should return min(eff_dt) and max(end_dt) value
    suppose below data in my item table
    item_id    eff_dt           end_dt
    10         20-jun-2012     25-jun-2012
    10         26-jun-2012     28-jun-2012 There is no gap between two rows for item 10 then it should return rows like
    item_id eff_dt end_dt
    10 20-jun-2012 28-jun-2012
    item_id    eff_dt           end_dt
    12         20-jun-2012     25-jun-2012
    12         27-jun-2012     28-jun-2012 There is gap between two rows for item 12 then it should return like
    item_id eff_dt end_dt
    12 20-jun-2012 25-jun-2012
    12 27-jun-2012 28-jun-2012
    I hv tried using below query but it giv null value for last row
    SELECT   item_id, eff_dt, end_dt, end_dt + 1 AS newd,
             LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
              co_code, item_id) AS LEAD,
             (CASE
                 WHEN (end_dt + 1) =
                        LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
                         co_code, item_id, eff_dt)
                    THEN '1'
                 ELSE '2'
              END
             ) AS new_num
      FROM item
       WHERE TRIM (item_id) = '802'
    ORDER BY ctry_code, co_code, item_id, eff_dtI m using oracle 10g.
    please any help is appreciate.
    Thanks.

    Use start of group method:
    with sample_table as (
                          select 10 item_id,date '2012-6-20' start_dt,date '2012-6-25' end_dt from dual union all
                          select 10,date '2012-6-26',date '2012-6-26' from dual
    select  item_id,
            min(start_dt) start_dt,
            max(end_dt) end_dt
      from  (
             select  item_id,
                     start_dt,
                     end_dt,
                     sum(start_of_group) over(partition by item_id order by start_dt) grp
               from  (
                      select  item_id,
                              start_dt,
                              end_dt,
                              case lag(end_dt) over(partition by item_id order by start_dt)
                                when start_dt - 1 then 0
                                else 1
                              end start_of_group
                        from  sample_table
      group by item_id,
               grp
      order by item_id,
               grp
       ITEM_ID START_DT  END_DT
            10 20-JUN-12 26-JUN-12
    SQL> SY.

  • ERMS - how to find relationships between e-mails?

    Dear all,
    I'm working with e-mail management and I'd like to know if there is a way to find relationship between e-mails.
    Let's assume an e-mail is sent: the workflow for the same is created and an entry appears in the Inbox.
    Now, let's assume the customer writes a new e-mail in the same e-mail chain, to add some details (or answer to our reply): a new workflow is initiated and a new e-mail is available now in the agent inbox.
    Is the system able somehow to recognize that the two e-mails belong to the same chain? For operators, it would be important to know that, to avoid double processing of customer requests.
    When I use role IC_MANAGER an use the e-mail workbench, I see that in the second e-mail the linkage to the first is identified, but when the same reaches the inbox I was not able to find any useful field to identify this information.
    Anybody with experience on this?
    I'll reward points if you can help!
    Thanks and Regards,
    AR

    Hi Andrea
    Have you checkout out the Mail Form Tracking capabilities?
    Particularly for Service Tickets.
    This may provide some of the functionality you require
    Regards
    Arden

  • How To Find joins between siebel tables

    Hi Experts,
    I am new in siebel and i am working on BI reports.
    I need to write queries to fetch data from sibel database.
    Any idea how do we find joins between table in siebel. Is there any user guide??
    Cheers,
    Andy

    Hi Andy,
    We can find Joins in Object Explorer. Expand the Business Component Object in Object Explorer and you can find Join. In Siebel generally we use only Equi Joins. ROW_ID of parent table will be stored in PAR_ROW_ID of child table. ROW_ID and PAR_ROW_ID are the columns of the table. Most of the tables have these two columns.
    For Example: Take two tables S_CONTACT AND S_CONTACT_X, the ROW_ID of S_CONTACT will be stored in PAR_ROW_ID of S_CONTACT_X table.
    If you want to join these two tables the query will be like
    "SELECT * FROM S_CONTACT CON, S_CONTACT_X CONX WHERE CON.ROW_ID = CONX.PAR_ROW_ID"
    This query will return all the records from S_CONTACT_X which matches S_CONTACT table.
    Thanks & Regards,
    Vinodhkumar

  • How to find relationship between database tables

    Hi Mate,s.
    Iam new to SAPBW , PLZ tell me , How to find releationship between database table(Transperent tables).
    Regards.
    harry

    hi harry,
    from your previous postings, i guess you are asking relationship between tables in r/3, following links may help :
    http://www.sapgenie.com/abap/tables.htm
    http://www.sapgenie.com/abap/tables_sd.htm
    http://www.sapgenie.com/abap/tables_mm.htm
    http://www.sapgenie.com/abap/tables_fi.htm
    http://www.sapgenie.com/abap/tables_ps.htm

  • How to find differene between two time fields??

    Hi Experts,
    I am trying to find difference between two time fields,  I have created two formula variables by using replacement path for the two time fields, I have taken dimension key NUMBER, because of this time format is converting to numbers for example if the time is 13:20:10 then it is converting to 1,32,010 then it is calculating, I am getting wrong values.
    Is there any options to find out the difference between two time fields.
    Thanks in advance,
    Venkat.

    use COPF_DETERMINE_DURATION. Its better you do it in data model itself.
    If you have date and time seperately use command
    use CONVERT TIMESTAMP command and
    then use this function module to get the difference in
    timestamp
    CCU_TIMESTAMP_DIFFERENCE
    us this in conjunction with the below function module
    DAYS_BETWEEN_TWO_DATES
    Edited by: Ananda Theerthan on Jan 21, 2010 7:18 AM

  • Find Link between Field, Segment, Idoc

    Hi Experts
    I would like to know how to find link between IDoc, Segment and Fileds.
    For Example : I know field Name Then i wild like to know Which Idoc and segment contain this field name.
    Thanks in advance,
    Jaykumar.M.

    Hi Jayakumar,
    I think this is the same old question on how to find out in what tables a field may be used.
    Segments are DDIC structures. A where-used-list on the data element of the field (eventually with some restrictions on the resulting objects name) should show the segments where is is used. The you can check table EDISEG recursively.
    Regards,
    Clemens

Maybe you are looking for

  • Erro impressão DANFE - IE e ST da J_1BSTAST

    PessoALL, Estou com um problema um pouco crítico... será que alguém pode me ajudar? O programa de impressão da DANFE não está extraindo a informação de Inscrição Estadual de Substituição Tributária da tabela de customizing (J_1BSTAST). Precisamos faz

  • How do I convert an excel file to a pdf, NOT a pdf to excel

    Until this year, I've been running OSX 10.5 Leopard. When I wanted to convert a Microsoft for Mac Excel worksheet to a pdf file, I simply clicked File/Print/PDF (in the lower left corner of the dialogue box)/then, Save as pdf. No problem, perfect pdf

  • Grinding noise when my HP LaserJet Pro 400 color MFP M475 calibrates

    When my HP LaserJet Pro 400 color MFP M475 recalibrates, I get a grinding or gear slipping noise.  Any idea how to fix it or what to look for? This question was solved. View Solution.

  • Any resolution with Xfi cards and Win 7 64bit with over 4gb??

    I recently went from 2gb to 4gb and found that my xtremegamer will not work unless I set the GB below 4gb. I have all updated drivers. I don't want to decrease my ram or buy a new card/use onboard sound. I see that this issue has been ongoing for qui

  • WLS 6.1sp3 classloader loads all archives within WEB-INF/lib/*

              Within the lib directory of my webapp, I have several different versions of myarchive.jar.           In WLS 6.0 I would keep older version within the lib directory but renaming them           so that the current release would get loaded.