The search syntax of SQL query against the data type varchar2 preserving valid data.

Have a data model that we are not allowed to change and the column in question is a varchar2 (20). The column has at this stage no foreign key to the list of valid values. So, until we can get those who control the data model in order to make the adjustments we need for a SQL query that root out us bad data on the hours fixed.

Is what we expect to be good data below:

-Whole number, without floating point
-Length of 5 or less (greater than zero but less than 99999)
-Text "No_RP" can exist.

Request demo below works most of the time with the exception of 'or Column1 is null' is not contagious in the null record. I tried to change the logical terms around, but did not understand the correct layout still provide it. So help would be greatly appreciated it someone could put me straight on how to properly register a null value in the recordset that has been selected with other types of error for end users to correct their mistakes. Another thing, I suppose there could be a better approach syntactically to a call find all offender characters such as *, &, (and so on.)

WITH Sample_Data AS (SELECT '0' collar OF DOUBLE UNION ALL)
SELECT "2" collar OF DOUBLE UNION ALL
SELECT "99999" col OF DOUBLE UNION ALL
SELECT "100000" col OF DOUBLE UNION ALL
SELECT '1 a' collar OF DOUBLE UNION ALL
SELECT the "ABCD" OF DOUBLE UNION ALL pass
SELECT 'A1' collar OF DOUBLE UNION ALL
SELECT ' *' collar OF DOUBLE UNION ALL
SELECT "/" pass OF DOUBLE UNION ALL
SELECT '-' col OF DOUBLE UNION ALL
SELECT ' ' collar OF DOUBLE UNION ALL
SELECT "pass OF DOUBLE UNION ALL
4. SELECT 5 6' collar OF DOUBLE UNION ALL
SELECT "24.5" collar OF DOUBLE UNION ALL
SELECT '-3' collar OF DOUBLE UNION ALL.
SELECT 'A' collar OF DOUBLE UNION ALL
SELECT 'F' OF DOUBLE UNION ALL cervical
SELECT the 'Z' OF DOUBLE UNION ALL pass
SELECT the pass 'Bye' FROM DUAL UNION ALL
SELECT the "Hello World" OF DOUBLE UNION ALL pass
SELECT "=" col OF DOUBLE UNION ALL
SELECT "+" col OF DOUBLE UNION ALL
SELECT '_' pass OF DOUBLE UNION ALL
SELECT '-' col OF DOUBLE UNION ALL
SELECT ' (' col OF DOUBLE UNION ALL)
SELECT ')' collar OF DOUBLE UNION ALL
SELECT '&' collar OF DOUBLE UNION ALL
SELECT ' ^' collar OF DOUBLE UNION ALL
SELECT '%' collar OF DOUBLE UNION ALL
SELECT the pass of "$" OF DOUBLE UNION ALL
SELECT the pass ' # ' TO DOUBLE UNION ALL
SELECT ' @' collar OF DOUBLE UNION ALL
SELECT '!' collar OF DOUBLE UNION ALL
SELECT ' ~' collar OF DOUBLE UNION ALL
SELECT "' collar OF DOUBLE UNION ALL
SELECT '.' pass FROM DUAL
)
SELECT col from Sample_data
WHERE (translate (col, '_0123456789', '_') is not null
or length (col) > 5
col = 0 or
or col is null)
and (upper (col) <>'NO_RP');

One more thing, I also took the approach of the regular expression, but he could not understand. If anyone knows how to do with this approach, I would also appreciate learning this method as well. Below is a close because I had. Impossible to get a range to work as "between 0 and 100000", guessing because of the comparison of varchar2 and # even attempted using to_char and to_number.

Select to_number (column1) from the testsql where REGEXP_LIKE (column1, ' ^ [[: digit:]] + $') ORDER BY to_number (column1) CSA;

Thanks in advance for anyone to help.

Nick

Hello

Thanks for posting the sample data in a useable form.
It would be useful that you also posted the accurate results you wanted from this data. You want the same results as those produced by the query you posted, except that nulls should be included? If so:

SELECT     col
FROM     sample_data
WHERE     CASE
         WHEN  UPPER (col) = 'NO_RP'               THEN  1
         WHEN  col IS NULL                    THEN -1
         WHEN  LTRIM (col, '0123456789') IS NOT NULL     THEN -2
         WHEN  LENGTH (col) > 5               THEN -3
                                       ELSE TO_NUMBER (col)
     END     NOT BETWEEN     1
              AND          99999
;

The requirement that pass! = 0 gives that much more difficult. You could test easily for an integer from 1 to 5 digits, but then you must have a separate condition to make sure that the chain was not '0', '00', '000', ' 0000 'or ' 00000'.
(Unlike Solomon, I guess that do not want to choose no-0 numbers starting by 0, such as ' 007 'or ' 02138'.)

Using regular expressions, you may lose a few keystrokes, but you also lose a lot of clarity:

SELECT     col
FROM     sample_data
WHERE     REGEXP_LIKE ( col
              , '^0{1,5}$'
              )
OR NOT     REGEXP_LIKE ( NVL ( UPPER (col)
                 , 'BAD'
                 )
              , '^(([1-9][0-9]{0,4})|NO_RP)$'
              )
;

Published by: Frank Kulash, December 13, 2010 21:50

Published by: Frank Kulash, December 13, 2010 22:11
Added regular expression solution

Tags: Database

Similar Questions

  • Help me with SQL Query to retrieve data from a view

    Hello Guru,

    I need help in my sql query.
    I use SQL TeraData.
    I want an Oracle result in the following form-

    Open tickets
    Open months failure / Repair Service s/o improvement request Total general
    2009-01-2 4 4 5 15
    2009-02 1 0 2 3 6
    2009-03 4 1 2 2 9
    Grand Total 7 5 8 10 30


    I wrote the query as where - TIME_PERIOD, RQST_TYPE_DM and DEMAND_SUMMARY_FCT are the points of view and I extract the data from the views only.

    Select NVL (CA. TIME_PERIOD. PERIOD_CD, 'Total') THAT year.
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% of Break' THEN 1 END) as BreakFix
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'N/a', 1 END) by n/a
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'Improvement' THEN 1 END) accessories
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% Service' THEN 1 END) as ServiceRequests
    COUNT (CA. RQST_TYPE_DM. RQSTTYP_DESC) AS grand_total
    FROM CA. TIME_PERIOD, CA. RQST_TYPE_DM, CA. DEMAND_SUMMARY_FCT
    WHERE (CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = CA. RQST_TYPE_DM. RQSTTYP_ID)
    AND (CASE
    WHEN CA. DEMAND_SUMMARY_FCT. MONTH_ID = CA. TIME_PERIOD. PERIOD_ID, 1
    WHEN {fn concat ({fn concat (SUBSTR (CA. TIME_PERIOD. {(PERIOD_CD, 3, 4),'-')}, SUBSTR (CA. TIME_PERIOD. PERIOD_CD, 7, 2))} BETWEEN ' 2009-01' AND ' 2009-03' THEN 1
    WHEN CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = '1' then 1
    END) = 1
    GROUP BY ROLLUP (CA. TIME_PERIOD. PERIOD_CD)

    After executing the query, I get the following error:
    3076: syntax Error: Data Type 'Time' does not match a defined Type name.
    :( Kindly help me with this and let me know where I'm wrong... Please.

    Messages indicates something wrong with your data... It would seem that the data does not match your format mask.

    Thus, the data or the format mask.

  • SQL query for retrieving data based on Certain model

    Hi all

    I want to retrieve all the identifiers of all the people who are permanently seated during the last hour.

    Data are expressed as below:

    -Creation of the activity Table

    CREATE TABLE activity_log

    (

    Username, NUMBER of

    Activity VARCHAR2 (30),

    StartTime VARCHAR2 (6).

    EndTime VARCHAR2 (6)

    );

    -Filling with sample data

    INSERT INTO activity_log VALUES('39','Walking','09:01','09:05');

    INSERT INTO activity_log VALUES('39','Walking','09:06','09:10');

    INSERT INTO activity_log VALUES('39','Sitting','09:11','09:15');

    INSERT INTO activity_log VALUES('39','Sitting','09:16','09:20');

    INSERT INTO activity_log VALUES('39','Sitting','09:21','09:25');

    INSERT INTO activity_log VALUES('39','Standing','09:26','09:30');

    INSERT INTO activity_log VALUES('39','Standing','09:31','09:35');

    INSERT INTO activity_log VALUES('39','Sitting','09:36','09:40');

    INSERT INTO activity_log VALUES('39','Sitting','09:41','09:45');

    INSERT INTO activity_log VALUES('39','Sitting','09:46','09:50');

    INSERT INTO activity_log VALUES('39','Sitting','09:51','09:55');

    INSERT INTO activity_log VALUES('39','Sitting','09:56','10:00');

    INSERT INTO activity_log VALUES('39','Sitting','10:01','10:05');

    INSERT INTO activity_log VALUES('39','Sitting','10:06','10:10');

    INSERT INTO activity_log VALUES('39','Sitting','10:11','10:15');

    INSERT INTO activity_log VALUES('39','Sitting','10:16','10:20');

    INSERT INTO activity_log VALUES('39','Sitting','10:21','10:25');

    INSERT INTO activity_log VALUES('39','Sitting','10:26','10:30');

    INSERT INTO activity_log VALUES('39','Sitting','10:31','10:35');

    INSERT INTO activity_log VALUES('39','Standing','10:36','10:40');

    INSERT INTO activity_log VALUES('39','Standing','10:41','10:45');

    INSERT INTO activity_log VALUES('39','Walking','10:46','10:50');

    INSERT INTO activity_log VALUES('39','Walking','10:51','10:55');

    INSERT INTO activity_log VALUES('39','Walking','10:56','11:00');

    INSERT INTO activity_log VALUES('40','Walking','09:01','09:05');

    INSERT INTO activity_log VALUES('40','Walking','09:06','09:10');

    INSERT INTO activity_log VALUES('40','Sitting','09:11','09:15');

    INSERT INTO activity_log VALUES('40','Sitting','09:16','09:20');

    INSERT INTO activity_log VALUES('40','Sitting','09:21','09:25');

    INSERT INTO activity_log VALUES('40','Standing','09:26','09:30');

    INSERT INTO activity_log VALUES('40','Standing','09:31','09:35');

    INSERT INTO activity_log VALUES('40','Sitting','09:36','09:40');

    INSERT INTO activity_log VALUES('40','Sitting','09:41','09:45');

    INSERT INTO activity_log VALUES('40','Sitting','09:46','09:50');

    INSERT INTO activity_log VALUES('40','Sitting','09:51','09:55');

    INSERT INTO activity_log VALUES('40','Walking','09:56','10:00');

    INSERT INTO activity_log VALUES('40','Sitting','10:01','10:05');

    INSERT INTO activity_log VALUES('40','Standing','10:06','10:10');

    INSERT INTO activity_log VALUES('40','Standing','10:11','10:15');

    INSERT INTO activity_log VALUES('40','Walking','10:16','10:20');

    INSERT INTO activity_log VALUES('40','Walking','10:21','10:25');

    INSERT INTO activity_log VALUES('40','Walking','10:26','10:30');

    INSERT INTO activity_log VALUES('40','Sitting','10:31','10:35');

    INSERT INTO activity_log VALUES('40','Sitting','10:36','10:40');

    INSERT INTO activity_log VALUES('40','Sitting','10:41','10:45');

    INSERT INTO activity_log VALUES('40','Standing','10:46','10:50');

    INSERT INTO activity_log VALUES('40','Walking','10:51','10:55');

    INSERT INTO activity_log VALUES('40','Walking','10:56','11:00');

    Based on the data, the user ID 39 must be found, since it's been sitting since 09:36-10:35, which is continuous 1 hour.

    Any guidance how to do using SQL query will be of great help and appreciation.

    Thank you very much

    Kind regards

    Bilal

    So what exactly is wrong with the request that I already gave you?

    Just to remind one untested (because of lack of insert statements) rewrite according to your new data:

    with grp as)

    Select

    username

    UserRecognizedActivityID activity

    starttime

    starttime + endetime + 1

    row_number() over (partition by order of starttime userid)

    -ROW_NUMBER() over (partition of userid, UserRecognizedActivityID order of starttime)

    RN

    of activity_log

    )

    Select

    username

    min (starttime) starttime

    max (endtime) endtime

    max (activity) activity

    GRP

    Group userid, rn

    with round (max (endtime) - min (starttime) * 24 * 60) > = 59

  • SQL Query to extract data between days and hours

    Hi friends,

    I need, it's for a report.

    Description of the requirement:

    Need of data in a table located in an OPEN State for more than 30 minutes

    Well, this requirement can be obtained from

    Select * from xyz where status = 'OPEN' and last_update_date < = sysdate---30 (30/1440) minutes and it is a parameter

    the query above will search all data that are in the OPEN State beginning to sysdate - (30/1440). So I want to change the query to restrict the data, by adding another parameter as DAY

    for example if I give 10 day, it should recover all the data only within 10 days and sysdate-30 minutes.

    We use the last_update_date column to restrict the day.

    If I do not give any date for entry must retrieve all records of sysdate-30 minutes.

    If I don't give minutes that he must retrieve all the records in the OPEN State.

    is the question clear enough? my English is bad.

    Please suggest me a query...

    Thank you and best regards,

    Arun Thomas T

    Hello

    Select * from xyz where status = 'OPEN' and

    last_update_date between nvl (sysdate -: days, last_update_date) and nvl2 (: days, last_update_date, nvl (sysdate -: minutes/1440, last_update_date));

    that should be:

    If the days parameter is entered then start - days of sysdate and end up last_update_date

    If days is not entered then boot from the begingin and put end to:

    1 sysdate -: minutes/1440 if minutes are entered

    2. up to the last_update_date if the minutes are not entered

  • SQL query to group data by Code and dates

    Hello

    I have the following table structure

    col1 col2 col3
    January 21, 2012 tested Code1
    January 20, 2012 tested Code1
    June 1, 2012 tested Code1
    June 1, 2012 tested Code2
    code 3 tested June 4, 2012

    so now

    The output should be something like

    code week1 week semaine2 3 semaine4 week5 until the last 14 weeks from the date that we run
    code 1 1 0 0 0 0
    Code2 1 0 0 0 0
    code 3 0 1 0 0 0

    where 1, 0 is in fact the charges and no sum and the week in this case perhaps should since we are in the second week, he should be

    code... .week3 may semaine4 peut week1 jun week2june


    Was looking for suggestions on how to achieve this.

    I guess that this would require some kind of a pivot query?

    Thank you
    Sun

    Hello

    Here's how you can make this pivot in Oracle 10.2. (In fact, it will work in Oracle 9.1 or higher.)

    WITH  got_week_num  AS
    (
         SELECT  error_code, date_logged
         ,     1 + FLOOR ( ( TO_DATE (:end_dt_txt, 'DD-Mon-YYYY') - date_logged)
                         / 7
                     )     AS week_num
         FROM    data_analysis
         WHERE     date_logged     >= TO_DATE (:start_dt_txt, 'DD-Mon-YYYY')
         AND     date_logged     <  TO_DATE (:end_dt_txt,   'DD-Mon-YYYY') + 1
    )
    ,     all_weeks     AS
    (
         SELECT     LEVEL               AS week_num
         ,     TO_CHAR ( 1 + TO_DATE (:end_dt_txt, 'DD-Mon-YYYY')
                       - (7 * LEVEL)
                   , 'fmDD-Mon-YYYY'
                   )          AS heading
         FROM    dual
         CONNECT BY     LEVEL <= 1 + FLOOR ( ( TO_DATE (:end_dt_txt,   'DD-Mon-YYYY')
                                             - TO_DATE (:start_dt_txt, 'DD-Mon-YYYY')
                                  )
                                / 7
                                )
    )
    SELECT       NULL                                   AS error_code
    ,       MIN (CASE WHEN week_num =  1 THEN heading END)     AS week_1
    ,       MIN (CASE WHEN week_num =  2 THEN heading END)     AS week_2
    --       ...
    ,       MIN (CASE WHEN week_num =  5 THEN heading END)     AS week_5
    FROM       all_weeks
           --
         UNION ALL
                --
    SELECT       error_code
    ,       TO_CHAR (COUNT (CASE WHEN week_num =  1 THEN 1 END))     AS week_1
    ,       TO_CHAR (COUNT (CASE WHEN week_num =  2 THEN 1 END))     AS week_2
    --       ...
    ,       TO_CHAR (COUNT (CASE WHEN week_num =  5 THEN 1 END))     AS week_5
    FROM       got_week_num
    GROUP BY  error_code
                 --
    ORDER BY  error_code     NULLS FIRST
    ;
    

    Output:

    ERROR_CODE WEEK_1      WEEK_2      WEEK_5
    ---------- ----------- ----------- -----------
               4-Jun-2012  28-May-2012 7-May-2012
    a          3           0           0
    b          0           2           1
    c          0           0           1
    

    Once more, the number of columns, such as aliases, is hard-coded in the query.
    If you want the number of columns, or their aliases depends on the data in the table, then you need dynamic SQL. See {message identifier: = 3527823}

    Did you ever what defined a "week" is in this query?
    The query above makes week_1 end to the given date (: end_dt_txt). The first week (in other words, an ioncluding: start_dt_txt) may have less than 7 days.
    If you want all the weeks to start Monday (in which case, the first and the last few weeks may have less than 7 days) see stew solution, using TRUNC (date_logged, 'IW').

  • SQL Query to retrieve data in XML format with several levels

    Hello

    I'm looking to help generate XML from Oracle database. The request must contain many levels of sub...

    For example.
    Create table inventory
    (Group varchar2 (10))
    category varchar2 (10),
    ProductName varchar2 (10),
    Detail varchar2 (10));

    The output should be also present below. The data must be multiple values for each item.

    < inventory >
    < name of group 'auto' = >
    < category name 'cars' = >
    < name productname = 'Seat' >
    < details > red color < / details >
    < details > 5 seats < / details >
    < / productname >
    < / category >
    < / Group >
    < / inventory >

    Please share your ideas by retrieving data in the XML structure using SQL or PL/SQL for oracle 10 g.

    Thank you and best regards,
    Siva.

    This?

    SQL> create table t as
    with t as (
     select 'automobiles' "GROUP", 'cars' category, 'seat' productname, 'color red' details from dual union all
     select 'automobiles', 'cars', 'seat', '5 seats' from dual union all
     select 'automobiles', 'cars', 'make', 'ford' from dual union all
     select 'automobiles', 'cars', 'make', 'Toyota' from dual union all
     select 'automobiles', 'Bus', 'Model', 'volvo' from dual union all
     select 'automobiles', 'flight', 'Airbus', '400 passenger' from dual union all
     select 'automobiles', 'flight', 'Airbus', '500 mph' from dual union all
     select 'HealthCare', 'Nutrition', 'centrum', 'Organic' from dual union all
     select 'HealthCare', 'Nutrition', 'centrum', 'Chemical' from dual union all
     select 'Computers', 'Software', 'Database', 'Oracle' from dual union all
     select 'Computers', 'Software', 'Database', 'sqlserver' from dual
    )
    select * from t
    /
    Createtable successfully completed.
    
    SQL> select xmlserialize (content x.column_value indent) xml
      from xmltable('element Inventory
                     {for $g in distinct-values(ora:view("t")/ROW/GROUP)
                       return element group
                          {attribute name {$g},
                            for $c in distinct-values(ora:view("t")/ROW[GROUP=$g]/CATEGORY)
                              return element category {attribute name {$c},
                                for $p in distinct-values(ora:view("t")/ROW[GROUP=$g and CATEGORY=$c]/PRODUCTNAME)
                                  return element productname {attribute name {$p},
                                    for $d in distinct-values(ora:view("t")/ROW[GROUP=$g and CATEGORY=$c and PRODUCTNAME=$p]/DETAILS)
                                      return element details {$d}
                                                             }
                                                      }
                          }
                     }') x
    /
    XML
    --------------------------------------------------------------------------------
    
      
        
          
            
    Oracle
    sqlserver
    Chemical
    Organic
    volvo
    Toyota
    ford
    5 seats
    color red
    400 passenger
    500 mph
    1 row selected.
  • Only download the form type VARCHAR2 column numbers

    Hello
    How can I extract only numbers form varchar2 column type?
    I have data like below.

    25 - Abc
    233 - xyz
    x23A
    9 - dd

    I need following output
    25
    233
    23
    9

    Thank you
    Sujnan

    Hi try this

    SQL> with t as(select '25-Abc' test_string from dual union all
      2  select '233-xyz' from dual union all
      3  select 'x23A' from dual union all
      4  select '9-dd' from dual)
      5  select regexp_substr(test_string,'[[:digit:]]+') from t;
    
    REGEXP_
    -------
    25
    233
    23
    9
    
  • Help in the Search Condition in the SQL query

    Hi gurus,

    I had the table with 3 columns
    col1           col2             col3
    123        johns123     edwin321s
    seenu       janu      satya123reset
    3456       kris         123stest
    
    In single SQL query i want to print the value based on the '123' is  
    
    123,john123,
    satya123reset,
    123test
    
    or to print the records starts with 's' like 
    s123
    seenu,satya123reset
    stest
    Thanks in advance

    Published by: SeenuGuddu on October 15, 2009 21:55

    Published by: SeenuGuddu on October 15, 2009 21:55

    Published by: SeenuGuddu on October 15, 2009 22:07

    Hello

    Not sure you mean exactly, but maybe you could do something like:

    MHO%xe> with t as ( -- generating your sample data:
      2  select '123' col1, 'johns123' col2, 'edwin321s' col3 from dual union all
      3  select 'seenu', 'janu', 'satya123reset' from dual union all
      4  select '3456', 'kris', '123stest' from dual
      5  )
      6  --
      7  -- actual query:
      8  --
      9  select rtrim ( case when col1 like '%123%' or col1 like 's%' then col1||', '  end
     10         ||      case when col2 like '%123%' or col2 like 's%' then col2||', '  end
     11         ||      case when col3 like '%123%' or col3 like 's%' then col3||', '  end
     12         , ', ')
     13  from   t;
    
    RTRIM(CASEWHENCOL1LIKE'%123%'ORC
    --------------------------------
    123, johns123
    seenu, satya123reset
    123stest
    

    You mention:

    or print the records begins by a ' as

    However the output desired is not begin with s for 's123' and "stest"... you can adjust your specification or your output...

  • 383 receving error while querying the data search

    Hello

    We have a script (vbs) that runs in Diadem and asks a Datafinder (Server edition). After the addition of a code of error handling, we encountered the following error:

    Error description: an error occurred while searching. The query can contain at least one invalid property.        Number: 383 Source: false.*

    * Now, according to the message above, we can extract that there is a property or a value of the property (of the application) makes / hurt, but see the next line from this message please.

    Once we took the trap for this error, we connect and save queries (in files TDQ) which were used at the present time that the error occurred. When load us the files of this query, no error is caused. We currently have to solve this problem, but we don't find the root cause yet. No guidance, the tip or help will be greatly appreciated.

    Hi manny,.

    This looks like a problem of type of property data for me.  In rare cases save a condition of tiara in a *.tdq file can cause this condition to change the data type of the property.  You can try to reduce the number of assignments to one and determine what state is the culprit?  Then ask yourself which operator you use in this condition - if it is "=" or "<>" then it supports any type of data.  If it's any other condition, then he could run against a string data type.  In addition, you may have a datetime property that is not optimized in the DataFinder, who could be considered an invalid property.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • Feature of the parallel execution of SQL query

    Hello guys,.

    I installed a 11 GR 2 Oracle RAC (11.2.0.3) database, but I see the use of the feature of running parallel SQL queries, but I never used that.

    I would like to know if this feature is enabled by default on CCR environments and if it does not require me to pay for Enterprise Edition.

    NAME DETECTED_USAGES FIRST_USA LAST_USAG CURRE

    ---------------------------------------------------------------- --------------- ----- --------- ---------

    Checking Options 1 TRUE 9 October 15 October 9, 15

    BMG Auto setting 1 TRUE 9 October 15 October 9, 15

    Memory of the execution of SQL auto 1 TRUE 9 October 15 October 9, 15

    Automatic management of the space Segment (System) 1 TRUE 9 October 15 October 9, 15

    Automatic Storage Management 1 TRUE 9 October 15 October 9, 15

    Management of the Undo Automatic 1 TRUE 9 October 15 October 9, 15

    Character set 1 TRUE 9 October 15 October 9, 15

    Deferred Segment creation 1 TRUE 9 October 15 October 9, 15

    Locally managed tablespaces (System) 1 TRUE 9 October 15 October 9, 15

    Locally managed tablespaces (user) 1 TRUE 9 October 15 October 9, 15

    Logfile multiplexing 1 TRUE 9 October 15 October 9, 15

    Oracle Java Virtual Machine (System) 1 TRUE 9 October 15 October 9, 15

    Oracle utility of metadata API 1 TRUE 9 October 15 October 9, 15

    1 SQL query in parallel TRUE 9 October 15 October 9, 15

    Partitioning (System) 1 TRUE 9 October 15 October 9, 15

    Real Application Clusters (RAC) 1 TRUE 9 October 15 October 9, 15

    Recovery zone 1 TRUE 9 October 15 October 9, 15

    SECUREFICHIERS (System) 1 TRUE 9 October 15 October 9, 15

    SECUREFICHIERS (user) 1 TRUE 9 October 15 October 9, 15

    The parameter server file 1 TRUE 9 October 15 October 9, 15

    Thanks in advance,

    Franky

    You are not, but Oracle is, since you are using RAC.  Oracle relies on execution in parallel against the gv$ views so even if you can't use it in SE way common Oracle can when it comes to query against one of the points of view gv$.  That's why DBA_FEATURE_USAGE_STATISTICS reports that you see.

    David Fitzjarrell

  • Clarification of the SQL query in 2 day + Guide APEX

    I worked through the Oracle Database Express Edition 2 day + Application Express Developer's Guide, and try to decipher the SQL query in Chapter 4 (building your app).

    The code is:

    SELECT d.DEPARTMENT_ID,

    d.DEPARTMENT_NAME,

    (select count (*) from oehr_employees where department_id = d.department_id)

    "Number of employees", he said.

    substr (e.first_name, 1, 1) |'. ' || Select 'Name Manager',

    c.COUNTRY_NAME 'place '.

    OEHR_DEPARTMENTS d,

    E OEHR_EMPLOYEES

    OEHR_LOCATIONS l,

    C OEHR_COUNTRIES

    WHERE d.LOCATION_ID = l.LOCATION_ID

    AND l.COUNTRY_ID = c.COUNTRY_ID

    AND e.department_id = d.DEPARTMENT_ID

    AND d.manager_id = e.employee_id

    AND instr (superior (d.department_name), superior (nvl (:P2_REPORT_SEARCH,d.department_name))) > 0)

    I don't know exactly what is happening in the last line. I think I understand what the different functions but I'm not clear on the use of the: P2_REPORT_SEARCH string.

    What does this string? This code simply checking that d.department_name isn't NA?

    I have SQL experience but am not very familiar with the Oracle PL/SQL implementation. Can someone please give me a brief breakdown that check is doing in the context of the overall query? The application seems to work even if the conditional statement is not included.

    Thank you.

    2899145 wrote:

    Thanks for the reply. I apologize if the information I added was incomplete. The code came from the day 2 + Application Express (version 4.2) Developer Guide.

    In the section 'your own Application of 4 Buuilding' https://docs.oracle.com/cd/E37097_01/doc.42/e35122/build_app.htm#TDPAX04000 , they describe the creation of a report

    page that includes the "manager_id" and 'location_id '. The SQL query, I pasted above extracted from the data in other tables to substitute the real 'name of the Manager' and 'rent '.

    for the corresponding ID values. It makes sense, and the part of the SQL query that explicitly doing this makes sense.

    However, given that the document is a guide for the development of the APEX, I guess the command:

    AND instr (upper (d.department_name), upper (nvl (:P2_REPORT_SEARCH,d.department_name))) > 0

    done something valuable, and I do not recognize what is exactly the value.

    From a practical point of view why would I need to include this conditional statement?  Which only added to the application?

    Looking at the guide in question, it is clear that the

    AND instr(upper(d.department_name),upper(nvl(:P2_REPORT_SEARCH,d.department_name)))>0
    

    the line is completely unnecessary in the context of this tutorial, and it can be removed. The search in the tutorial app page is implemented by using a report filter interactive rather than a P2_REPORT_SEARCH element, which does not seem to exist at all. (It's a quirk of the APEX that bind variable references to non-existent items are replaced with NULL silently rather than exceptions). I thought that perhaps it would be legacy code a version of the tutorial prior to the introduction of interactive reports at the APEX 3.1, but I can't find explicit instructions to create such an element of filter in the 3.0 tutorial. I guess it must have been automatically generated by the application wizard when you create a standard report page.

    If you do not want to see the effect he would have (as described in the post above), leave it in the source report, add a text element of P2_REPORT_SEARCH, and a button "submit" on page 2 and experimenting to find different values of the element and clicking on the submit button...

  • SQL QUERY THAT RETURNS THE PL/SQL

    Hello

    I'm putting in 4.2 below apex

    DECLARE

    date of frdate: =: P22_FROMDATE;

    date date: =: P22_TODATE;

    l_date1 varchar2 (11): = to_char(frdate,'dd-mon-yyyy');

    l_date2 varchar2 (11): = to_char(todate,'dd-mon-yyyy');

    v_sql varchar2 (32000);

    v_Name varchar2 (4000): = months_name (frdate, todate);

    char (1) of the v1: = q "[']";

    number of lbr1 (6): =: P22_FROMBRANCH;

    number of LBR2 (6): =: P22_TOBRANCH;

    number of M1 (6): = 11;

    Start

    v_sql: ='SELECT * FROM (SELECT LBRCODE, PRDACCTID, MN, AVGX FROM (SELECT LBRCODE, PRDACCTID, MN, SUM (BALL) BALL, COUNT (MN) DAYS, ROUND (SUM (BAL) count (MN), 2) AVGX ';))

    v_sql: = v_sql | "FROM (SELECT LBRCODE, PRDACCTID, TO_CHAR (BALDATE,'|)) CHR (39) | ' MM' | CHR (39) |') ' | ' ||'|| CHR (39) | » _'|| CHR (39) |' | ' || «TO_CHAR (BALDATE,'|)» CHR (39) | ' AAAA '. CHR (39) |') MN, BALL ';

    V_SQL: = V_SQL | "(SELECT Q2. LBRCODE, Q2. PRDACCTID, T1. BALDATE, T_OST_NEW (Q2. LBRCODE, Q2. PRDACCTID, T1. BALDATE) BALL ';

    V_SQL: = V_SQL | "FROM (select TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') baldate FROM DUAL Union all the ';

    V_SQL: = V_SQL |' select (TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') + level) double baldate ';

    V_SQL: = V_SQL |' connect by level < = (TO_DATE('||) Chr (39) | l_date2 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') -TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' Dd-mon-yyyy ' | CHR (39) |')) ) Q1,';

    V_SQL: = V_SQL | "(SELECT LBRCODE,'|) ' (rpad (prdcd, 8,'|)) V1 ||'' || v1 |') || LTRIM (rpad('|| v1 ||) » x'|| V1 | «, 25, » || v1 | » 0' || v1||'),'|| v1 | » x'|| v1 |')) prdacctid OF D009021 WHERE the LBRCODE between ' | : P22_FROMBRANCH |' and ' | : P22_TOBRANCH | "AND moduleinfo =' | TO_NUMBER(:P22_SELECTLIST);

    V_SQL: = V_SQL |') ((Q2)) GROUP BY LBRCODE, PRDACCTID, MN))';

    V_SQL: = V_SQL | "PIVOT (MAX (AVGX) (MN) IN (';))

    V_SQL: = V_SQL | V_NAME;

    V_SQL: = V_SQL |')) ORDER OF LBRCODE, PRDACCTID ';

    RETURN V_SQL;

    END;

    I created all the elements of the required page

    I get the error message like missing expression

    to test, I created a function to return the query, it works very well know to return a query that gives me desired report

    am I missing something?

    Help, please

    HEMU wrote:

    Hello Sir

    Sorry to bother you again

    I tried to use «function that returns colon-delimited topics»

    and I got following error

    unable to determine query headings: ORA-06550: line 1, column 138: PLS-00103: Encountered the symbol ";" when expecting one of the following:  . ( ) , * % & = - + < / > at in is mod remainder not rem =>  <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset The symbol ")" was substituted for ";" to continue.
    
    failed to parse SQL query:
    

    can take you a look at page901 once again please and a function named months_namex

    is it feasible that I'm looking for?

    The immediate cause of this error is simply incorrect report headings function call syntax:

    return months_namex(to_date(:p901_fromdate,'dd-mon-yyyy'),to_date(:p901_todate,'dd-mon-yyyy')

    This should be:

    return months_namex(to_date(:p901_fromdate,'dd-mon-yyyy'),to_date(:p901_todate,'dd-mon-yyyy'));

    However there is no months_namex function defined in the workspace.

  • Fast and slow when issued by app SQL query on the issue mnaually

    Hello

    I have a more general question concerning a specific behavior of Oracle.

    I update a feature of an application. The application is not responding and I finally put end. I checked Oracle if a request is long running by using the following statement:

    Select s.username,s.sid,s.serial#,s.last_call_et/60 mins_running, q.sql_text from v$ session s
    Join v$ sqltext_with_newlines q
    On s.sql_address = q.address
    When status = 'ACTIVE'.
    Type <>'BACKGROUND '.
    and last_call_et > 60
    order of sid, serial #, q.piece


    The result of the above query is:

    WITH CONNECTION AS (SELECT * FROM WW_CONN C WHERE (C.FID_FROM I))
    N (SELECT FID FROM WW_LINE WHERE FID_ATTR =: B1) AND C.F_CLASS_ID
    FROM = 22) OR (C.FIDto IN (SELECT FID FROM WW_LINE WHERE FID_AT))
    TR =: B1) AND C.F_CLASS_ID_TO = 22)) SELECT MIN (P.FID_ATTR) AS FI
    CONNECTION C, WW_POINT D_FROM P WHERE (P.FID = C.FID_FROM A
    C.F_CLASS_ID_FROM ND = 32 AND C.FLOW = 1) OR (P.FID = C.FID_TO
    C.F_CLASS_ID_TO ND = 32 AND C.FLOW = 2)

    I have another tool that shows me the connection parameter values. So I know that the value of: B1 is 5011 - the id of the feature updates. This query runs for 20 minutes and finally more time stops in front of him. The update process involves several sql statements - if it does not have the update, but is part of the process.

    Here's the bit I don't understand: when I run the query in SQL Developer with value 5011: B1 it takes 0.5 seconds to return a result.

    Why did the sql statement taking so long on the issue by the application, but takes less than one second when I run it manually?

    I sent a dump of the data to the vendor of the application that is not able to reproduce the problem in their environment. Could someone explain to me what is happening here or give me key words for the search?

    We use 11 GR 2, 64-bit.

    Thank you very much
    Rob

    Hi Rob,

    at least, you should see some differences in the statistics for the child cursor different (one for running the application must show at least a higher value for ELAPSED_TIME). I would like to use something like the following query to verify the information for the child cursors:

    select sql_id
         , PLAN_HASH_VALUE
         , CHILD_NUMBER
         , EXECUTIONS
         , ELAPSED_TIME
         , USER_IO_WAIT_TIME
         , CONCURRENCY_WAIT_TIME
         , DISK_READS
         , BUFFER_GETS
         , ROWS_PROCESSED
      from v$sql
     where sql_id = your_sql_id
    

    Concerning

    Martin

  • SQL query for the mapping of a set of prizes to a group of classrooms

    Hi all

    I use Oracle database 11g Release 2.

    I have the following data set:

    Classrooms
    ClassId ClassName ability group
    ------ ----------------------------------------------      --------------     -----------
    Babbage/software Engg Lab 1 24 1
    Basement 2 - block PG 63 1
    3 1 56 1 class
    Class 4 1 24 10
    Class 5 1 24 11
    Class 6 1 35 12
    7 13 42 1 class
    8 14 42 1 class
    9 15 42 1 class
    10 2 35 1 class
    11 3 35 1 class
    12 4 35 1 classroom
    13 5 35 1 class
    14 6 25 1 class
    15 7 25 1 class
    16 1 24 8 class
    17 9 24 1 class
    18 control Sys Lab 1 24
    19 dig & Embd Sys Lab 20 1
    20 PSD & Comm 20 1 Lab
    21 electromechanical system Lab 28 1
    Farabi 22/Web Tech Lab 1 36
    23 gen purpose Lab 40 1
    Shirazi/24dB Tech Lab 1 36
    ADV 25 elect Lab 30 2
    26 16 42 2 class
    27 17 49 2 class
    28 18 56 2 class
    29 19 42 2 class
    30 20 49 2 class
    Class 31 21 35 3
    32 22 35 3 class
    33 20 3 MDA lab

    DegreeBatches
    BatchId BatchName force
    ---------------     ----------------------- --------------
    1 BIT - 11 79
    2 BIT - 12 28
    3 BS (CS)-1 35
    4 BS (CS) 78-2
    5 BE (SE)-1 69
    6. BE (SE) 84-2
    7 BE (SE) 64-3
    8 84 BYTČA-7
    9 43 BYTČA-8
    BEE-1 10, 112
    11 151 BEE-2
    BEE-3 12, 157
    13 BEE-4 157

    I want to map a combination of batch of degree for a class rooms group of such distance that they make full use of the maximum capacity of the class rooms within a group (ideally), or as close to this as possible. Can it be done with a SQL query?

    Any response will be appreciated.

    The SQL Scripts to generate the required tables and populate data is less to:
    CREATE TABLE classrooms (ClassId NUMBER, ClassName VARCHAR2 (50), capacity NUMBER, group NUMBER);
    INSERT INTO the classrooms of the VALUES (1, "Babbage/software Engg Lab', 24, 1");
    INSERT INTO the classrooms of the VALUES (2, 'basement - PG block', 63, 1);
    INSERT INTO the classrooms of the VALUES (3, '1 class room', 56, 1);
    INSERT INTO the classrooms of the VALUES (4, '10 class room', 24, 1);
    INSERT INTO the classrooms of the VALUES (5, '11 class room', 24, 1);
    INSERT INTO the classrooms of the VALUES (6, 'class room 12', 35, 1);
    INSERT INTO the classrooms of the VALUES (7, 'class room 13', 42, 1);
    INSERT INTO the classrooms of the VALUES (8, 'class room 14', 42, 1);
    INSERT INTO the classrooms of the VALUES (9, '15 'class, 42, 1);
    INSERT INTO the classrooms of the VALUES (10, 'class 2', 35, 1);
    INSERT INTO the classrooms of the VALUES (11, 'class room 3', 35, 1);
    INSERT INTO the classrooms of the VALUES (12, 'class room 4', 35, 1);
    INSERT INTO the classrooms of the VALUES (13, 'class room 5', 35, 1);
    INSERT INTO the classrooms of the VALUES (14, 'class room 6', 25, 1);
    INSERT INTO the classrooms of the VALUES (15, '7 class room', 25, 1);
    INSERT INTO the classrooms of the VALUES (16, 'class Room 8', 24, 1);
    INSERT INTO the classrooms of the VALUES (17, 'class room 9', 24, 1);
    INSERT INTO the classrooms of the VALUES (18, 'Control Sys Lab', 24, 1);
    INSERT INTO the classrooms of the VALUES (19, 'Dig & Embd Sys Lab', 20, 1);
    INSERT INTO the classrooms of the VALUES (20, 'DSP & Comm Lab', 20, 1);
    INSERT INTO the classrooms of the VALUES (21, 'system ELECTROMECHANICAL Lab', 28, 1);
    INSERT INTO the classrooms of the VALUES (22, ' Farabi/Web Tech Lab', 36, 1);
    INSERT INTO the classrooms of the VALUES (23, 'Gen purpose Lab', 40, 1);
    INSERT INTO the classrooms of the VALUES (24, ' Shirazi/DB Tech Lab', 36, 1);
    INSERT INTO the classrooms of the VALUES (25, 'Elected Adv Lab', 30, 2);
    INSERT INTO the classrooms of the VALUES (26, 'class room 16', 42, 2);
    INSERT INTO the classrooms of the VALUES (27, 'class room 17', 49, 2);
    INSERT INTO the classrooms of the VALUES (28, '18 'class, 56, 2);
    INSERT INTO the classrooms of the VALUES (29, '19 'class, 42, 2);
    INSERT INTO the classrooms of the VALUES (30, 'class room 20', 49, 2);
    INSERT INTO the classrooms of the VALUES (31, 'class room 21', 35, 3);
    INSERT INTO the classrooms of the VALUES (32, 'room 22', 35, 3);
    INSERT INTO the classrooms of the VALUES (33, 'MDA Lab', 20, 3);

    CREATE TABLE DegreeBatches (BatchId NUMBER, BatchName VARCHAR2 (50), membership NUMBER);
    INSERT INTO DegreeBatches VALUES(1,'BIT-11',79);
    INSERT INTO DegreeBatches VALUES(2,'BIT-12',28);
    INSERT INTO DegreeBatches VALUES (3, 'BS (CS) - 1', 35);
    INSERT INTO DegreeBatches VALUES (4, 'BS (CS) - 2', 78);
    INSERT INTO DegreeBatches VALUES (5,'BE (SE) - 1', 69);
    INSERT INTO DegreeBatches VALUES (6,'BE (SE) - 2', 84);
    INSERT INTO DegreeBatches VALUES (7,'BE (SE) - 3', 64);
    INSERT INTO DegreeBatches VALUES(8,'BICSE-7',84);
    INSERT INTO DegreeBatches VALUES(9,'BICSE-8',43);
    INSERT INTO DegreeBatches VALUES(10,'BEE-1',112);
    INSERT INTO DegreeBatches VALUES(11,'BEE-2',151);
    INSERT INTO DegreeBatches VALUES(12,'BEE-3',157);
    INSERT INTO DegreeBatches VALUES(13,'BEE-4',157);

    Best regards
    Bilal

    Published by: Bilal on December 27, 2012 09:52

    Published by: Bilal on December 27, 2012 10:07

    Bilal, thanks for the nice problem! Another possibility to double check is to write a small PL/SQL function that returns 1 if a duplicate id is found, then equate to 0: "NUMBER of RETURN of Duplicate_Token_Found (p_str_main in VARCHAR2, p_str_trial VARCHAR2). It should analyze the second string and could use p_str_main LIKE '%', | l_id | ', %' for each id. In any case, the query complete (without that) is given below:

    Solution with names
    SQL> WITH rsf_itm (con_id, max_weight, nxt_id, lev, tot_weight, tot_profit, path, root_id, lev_1_id) AS (
      2  SELECT c.id,
      3         c.max_weight,
      4         i.id,
      5         0,
      6         i.item_weight,
      7         i.item_profit,
      8         ',' || i.id || ',',
      9         i.id,
     10         0
     11    FROM items i
     12   CROSS JOIN containers c
     13   UNION ALL
     14  SELECT r.con_id,
     15         r.max_weight,
     16         i.id,
     17         r.lev + 1,
     18         r.tot_weight + i.item_weight,
     19         r.tot_profit + i.item_profit,
     20         r.path || i.id || ',',
     21         r.root_id,
     22         CASE WHEN r.lev = 0 THEN i.id ELSE r.nxt_id END
     23    FROM rsf_itm r
     24    JOIN items i
     25      ON i.id > r.nxt_id
     26     AND r.tot_weight + i.item_weight <= r.max_weight
     27   ORDER BY 1, 2
     28  ) SEARCH DEPTH FIRST BY nxt_id SET line_no
     29  , rsf_con (nxt_con_id, nxt_line_no, con_path, itm_path, tot_weight, tot_profit, lev) AS (
     30  SELECT con_id,
     31         line_no,
     32         To_Char(con_id),
     33         ':' || con_id || '-' || (lev + 1) || ':' || path,
     34         tot_weight,
     35         tot_profit,
     36         0
     37    FROM rsf_itm
     38   UNION ALL
     39  SELECT r_i.con_id,
     40         r_i.line_no,
     41         r_c.con_path || ',' || r_i.con_id,
     42         r_c.itm_path ||  ':' || r_i.con_id || '-' || (r_i.lev + 1) || ':' || r_i.path,
     43         r_c.tot_weight + r_i.tot_weight,
     44         r_c.tot_profit + r_i.tot_profit,
     45         r_c.lev + 1
     46    FROM rsf_con r_c
     47    JOIN rsf_itm r_i
     48      ON r_i.con_id > r_c.nxt_con_id
     49   WHERE r_c.itm_path NOT LIKE '%,' || r_i.root_id || ',%'
     50     AND r_c.itm_path NOT LIKE '%,' || r_i.lev_1_id || ',%'
     51     AND r_c.itm_path NOT LIKE '%,' || r_i.nxt_id || ',%'
     52  )
     53  , paths_ranked AS (
     54  SELECT itm_path || ':' itm_path, tot_weight, tot_profit, lev + 1 n_cons,
     55         Rank () OVER (ORDER BY tot_profit DESC) rnk,
     56         Row_Number () OVER (ORDER BY tot_profit DESC) sol_id
     57    FROM rsf_con
     58  ), best_paths AS (
     59  SELECT itm_path, tot_weight, tot_profit, n_cons, sol_id
     60    FROM paths_ranked
     61   WHERE rnk = 1
     62  ), row_gen AS (
     63  SELECT LEVEL lev
     64    FROM DUAL
     65  CONNECT BY LEVEL <= (SELECT Count(*) FROM items)
     66  ), con_v AS (
     67  SELECT  b.itm_path, r.lev con_ind, b.sol_id, b.tot_weight, b.tot_profit,
     68          Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev - 1) + 1,
     69            Instr (b.itm_path, ':', 1, 2*r.lev) - Instr (b.itm_path, ':', 1, 2*r.lev - 1) - 1)
     70             con_nit_id,
     71          Substr (b.itm_path, Instr (b.itm_path, ':', 1, 2*r.lev) + 1,
     72            Instr (b.itm_path, ':', 1, 2*r.lev + 1) - Instr (b.itm_path, ':', 1, 2*r.lev) - 1)
     73             itm_str
     74    FROM best_paths b
     75    JOIN row_gen r
     76      ON r.lev <= b.n_cons
     77  ), con_split AS (
     78  SELECT itm_path, con_ind, sol_id, tot_weight, tot_profit,
     79         Substr (con_nit_id, 1, Instr (con_nit_id, '-', 1) - 1) con_id,
     80         Substr (con_nit_id, Instr (con_nit_id, '-', 1) + 1) n_items,
     81         itm_str
     82    FROM con_v
     83  ), itm_v AS (
     84  SELECT  c.itm_path, c.con_ind, c.sol_id, c.con_id, c.tot_weight, c.tot_profit,
     85          Substr (c.itm_str, Instr (c.itm_str, ',', 1, r.lev) + 1,
     86            Instr (c.itm_str, ',', 1, r.lev + 1) - Instr (c.itm_str, ',', 1, r.lev) - 1)
     87             itm_id
     88    FROM con_split c
     89    JOIN row_gen r
     90      ON r.lev <= c.n_items
     91  )
     92  SELECT v.sol_id,
     93         v.tot_weight s_wt, v.tot_profit s_pr, c.id c_id, c.name c_name, c.max_weight m_wt,
     94         Sum (i.item_weight) OVER (PARTITION BY v.sol_id, c.id) c_wt,
     95         i.id i_id, i.name i_name, i.item_weight i_wt, i.item_profit i_pr
     96    FROM itm_v v
     97    JOIN containers c
     98      ON c.id = To_Number (v.con_id)
     99    JOIN items i
    100      ON i.id = To_Number (v.itm_id)
    101   ORDER BY sol_id, con_id, itm_id
    102  /
    
        SOL_ID S_WT S_PR  C_ID C_NAME          M_WT C_WT  I_ID I_NAME     I_WT I_PR
    ---------- ---- ---- ----- --------------- ---- ---- ----- ---------- ---- ----
             1  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     3 BSCS-2       35   35
                                                             5 BEE-4        50   50
             2  255  255     1 SEECS UG Block   100   95     4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   70     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
             3  255  255     1 SEECS UG Block   100  100     3 BSCS-2       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     1 BIT-10       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
             4  255  255     1 SEECS UG Block   100  100     3 BSCS-2       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     1 BIT-10       35   35
                                                             5 BEE-4        50   50
             5  255  255     1 SEECS UG Block   100   95     2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   70     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
             6  255  255     1 SEECS UG Block   100  100     2 BIT-11       40   40
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     1 BIT-10       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
             7  255  255     1 SEECS UG Block   100  100     2 BIT-11       40   40
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     1 BIT-10       35   35
                                                             5 BEE-4        50   50
             8  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   85     3 BSCS-2       35   35
                                                             5 BEE-4        50   50
             9  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            10  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   65     2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
            11  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             2 IAEC Building     70   65     4 BSCS-3       40   40
                                                             6 BICSE-7      25   25
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            12  255  255     1 SEECS UG Block   100   95     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     2 BIT-11       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
            13  255  255     1 SEECS UG Block   100   95     1 BIT-10       35   35
                                                             3 BSCS-2       35   35
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   70     4 BSCS-3       40   40
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     2 BIT-11       40   40
                                                             5 BEE-4        50   50
            14  255  255     1 SEECS UG Block   100  100     1 BIT-10       35   35
                                                             2 BIT-11       40   40
                                                             6 BICSE-7      25   25
                             2 IAEC Building     70   65     3 BSCS-2       35   35
                                                             7 BESE-3       30   30
                             3 RIMMS Building    90   90     4 BSCS-3       40   40
                                                             5 BEE-4        50   50
    
    98 rows selected.
    
    Elapsed: 00:00:01.42
    

    Published by: BrendanP on January 20, 2013 11:25
    I found the need to deduplicate regular expression:

    AND RegExp_Instr (r_c.itm_path | r_i.path, ',(\d+),.*?,\1,') = 0)

  • SQL query to retrieve all instances of a model within the column

    I had an obligation to build a query for the scenario below. Pls help to troubleshoot.

    Scenario.
    Table 1 has two columns < number > col1 and col2 < CLOB >
    The table has 2 rows

    < Number > col1 has the following values
    Row1-col1
    1

    Row2-col1
    2

    Col2 < Clob > has the following values

    Row1-col2
    blah blah blah blah blah blah blah A1235 A1234
    blah blah blah blah blah blah blah A1237 A1236

    Col2 Row2
    blah blah blah blah blah blah blah A1239 A1238


    The query should return (expected result)
    A1234
    A1235
    A1236
    A1237
    A1238
    A1239

    I tried with the substr, but it returns only the first occurrence of the pattern

    Query:
    Select
    REGEXP_SUBSTR (col2,
    "A [0-9] {4}') 'REGEXP_SUBSTR'"
    FROM table1


    Output:
    A1234
    A1238


    I want a loop must be created and check until the end of the column.
    Pls help me with the query. It will be useful.

    Thank you
    Nanan

    Published by: 950268 on August 1, 2012 07:19

    You can simulate loops with sql functions as the clause-type (since 10 g) or recursive subquery (since 11.2).
    Generally in this forum link it by the approach will be proposed.
    The depth will be the number of occurrences of your model and the level will be the real occurency.
    So just search inthi forum for an abundance of examples

    select regexp_substr(col2, 'A[0-9]{4}', 1, level)
    from tabel1
    connect by
    level <= regexp_count(col2,'A[0-9]{4}')
    

    regexp_count since 11. ?

    concerning

Maybe you are looking for

  • What is the right way to stop an external hard drive please?

    What is the right way to stop an external hard drive please?

  • I need an app to clean/speed up my iMac

    Y at - it good software that will clean/speed up my iMac in the app store or I can download from the internet.

  • Reg BrowserField Navigation problem

    Hi all I'm opening url using the browser field. now, if I clicked on a hyperlink or menu options, I need to get the url and the url I need to navigate a few other custom screen-based. How to implement these thing. If anyone knows then please answer m

  • Trouble with 0.9.4 Simulator

    I have fairly serious problems with the last (0.9.4) Playbook Simulator.  My application was working fine in the two previous simulators, but now it is having serious display problems. I have a screen where there is a part which is updated every seco

  • ACS 4.1 compatible with WLC 6.0.196.0

    Hello I have to upgrade our WLC4404s from version 4.2.207.0 to 6.0.196.0 so that our new 1142N APs are supported. Is someone can you please tell me if I am required to upgrade to Cisco Secure ACS version 4.1 and 4.2 to stay compatible (Windows) Pleas