TimesTen create a lock for a select statement through sqldev

What ttisql use connect to TimesTen Release 7.0.6.15.0 to autocommit = 1, there is no lock for a select statement.

but when I use sql developer (driver is ttjdbc5.jar, regardless of the version) to connect, even with autocommit = 1, there will be locks for the select statement.

Is this a bug? How can I achieve the same no lock for a select statement through sql developer? Thank you.

-your update told me that you are connected to a remote timesten data store using the client driver

-the output from ttXactAdmin shows that SqlNavigator has a shared lock on the database itself: it will not interfere with someone else "read operations and I think that until you actually try a kind of DML against the database that e IX lock on the database lock will not interfere with any other DML either."

-sharing database lock is still acquired for any transaction TimesTen. You can test it for yourself ttisql: set off autocommit, perform a simple update and do not commit the transaction. Then, open a separate session and run ttxactadmin - you will have the database IX lock as well as the various locks on the tables and indexes.

-I think this pretty much proves my original thought: this sqlDeveloper attaches to TimesTen in transaction mode. However, the IX lock on the database will not interfere with anyone else's work and should not be a problem.

Tags: Database

Similar Questions

  • SHOW_LOV need to pass a parameter for the select statement

    Hello

    I have a requirement that there is only a drop down list but the display of the list should be based on the certern parameter.

    I have a table (id, type, description). The select statement for dropdown I need is

    SELECT id, description of the table where type = & input_param.

    Can someone help please!

    create a field and create value in the list select id, description from table1 where col =: block1.item

  • creating a table from a select statement

    is it possible to run a select statement that creates a table based on the statement of execution? in MSSQL I can include 'in {tablename}"in a select statement and it will automatically create the table field names / on the fly?

    I know I can run "insertion in {tablename} select * from foo" to fill an existing table, but I want something that creates the table as well.
    create table 
    as select ...
    

    Is that what you are looking for?

    Nicolas.

  • Not finding the correct syntax for the select statement

    Hello

    The following statement works very well and gives the expected results:
    prompt
    prompt Using WITH t
    prompt
    
    with t as
      (
       select a.proj_id,
              a.proj_start,
              a.proj_end,
              case when (
                         select min(a.proj_start)
                           from v b
                          where (a.proj_start  = b.proj_end)
                            and (a.proj_id    != b.proj_id)
                        )
                        is not null then 0 else 1
              end as flag
         from v a
        order by a.proj_start
      )
    select proj_id,
           proj_start,
           proj_end,
           flag,
           --
           -- the following select statement is what I am having a hard time
           -- "duplicating" without using the WITH clause
           --
           (
            select sum(t2.flag)
              from t t2
             where t2.proj_end <= t.proj_end
           ) s
      from t;
    As an academic exercise, I wanted to rewrite the above statement without using the WITH clause, I tried this (amongst dozens of other tests - I hit a mental block and cannot understand):
    prompt
    prompt without with
    prompt
    
    select c.proj_id,
           c.proj_start,
           c.proj_end,
           c.flag,
           --
           -- This is what I've tried as the equivalent statement but, it is
           -- syntactically incorrect.  What's the correct syntax for what this
           -- statement is intended ?
           --
           (
            select sum(t2.flag)
              from c t2
             where t2.proj_end <= c.proj_end
           ) as proj_grp
      from (
            select a.proj_id,
                   a.proj_start,
                   a.proj_end,
                   case when (
                              select min(a.proj_start)
                                from v b
                               where (a.proj_start  = b.proj_end)
                                 and (a.proj_id    != b.proj_id)
                             )
                             is not null then 0 else 1
                   end as flag
              from v a
             order by a.proj_start
           ) c;
    Thanks for the help, much appreciated.

    John.

    PS: The DDL for table v used by the above statements is:
    drop table v;
    
    create table v (
    proj_id         number,
    proj_start      date,
    proj_end        date
    );
    
    insert into v values
           ( 1, to_date('01-JAN-2005', 'dd-mon-yyyy'),
                to_date('02-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 2, to_date('02-JAN-2005', 'dd-mon-yyyy'),
                to_date('03-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 3, to_date('03-JAN-2005', 'dd-mon-yyyy'),
                to_date('04-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 4, to_date('04-JAN-2005', 'dd-mon-yyyy'),
                to_date('05-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 5, to_date('06-JAN-2005', 'dd-mon-yyyy'),
                to_date('07-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 6, to_date('16-JAN-2005', 'dd-mon-yyyy'),
                to_date('17-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 7, to_date('17-JAN-2005', 'dd-mon-yyyy'),
                to_date('18-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 8, to_date('18-JAN-2005', 'dd-mon-yyyy'),
                to_date('19-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           ( 9, to_date('19-JAN-2005', 'dd-mon-yyyy'),
                to_date('20-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (10, to_date('21-JAN-2005', 'dd-mon-yyyy'),
                to_date('22-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (11, to_date('26-JAN-2005', 'dd-mon-yyyy'),
                to_date('27-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (12, to_date('27-JAN-2005', 'dd-mon-yyyy'),
                to_date('28-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (13, to_date('28-JAN-2005', 'dd-mon-yyyy'),
                to_date('29-JAN-2005', 'dd-mon-yyyy'));
    insert into v values
           (14, to_date('29-JAN-2005', 'dd-mon-yyyy'),
                to_date('30-JAN-2005', 'dd-mon-yyyy'));
    select c.proj_id,
           c.proj_start,
           c.proj_end,
           c.flag,
           --
           -- This is what I've tried as the equivalent statement but, it is
           -- syntactically incorrect.  What's the correct syntax for what this
           -- statement is intended ?
           --
           (
            select sum(t2.flag)
              from (select a.proj_id,
                           a.proj_start,
                           a.proj_end,
                           case when (
                              select min(a.proj_start)
                                from v b
                               where (a.proj_start  = b.proj_end)
                                 and (a.proj_id    != b.proj_id)
                                     )  is not null then 0 else 1
                           end as flag
                      from v a
                     order by a.proj_start
                   ) t2
             where t2.proj_end <= c.proj_end
           ) as proj_grp
      from (
            select a.proj_id,
                   a.proj_start,
                   a.proj_end,
                   case when (
                              select min(a.proj_start)
                                from v b
                               where (a.proj_start  = b.proj_end)
                                 and (a.proj_id    != b.proj_id)
                             )
                             is not null then 0 else 1
                   end as flag
              from v a
             order by a.proj_start
           ) c;
    
  • Formatting for a select statement

    I am trying to include formatting in a select statement.

    The data, I'm pulling compared to the SSN for a unique value. The problem is that the SSN is formatted with dashes in a table and not in the other.

    Example:


    Table 1
    Name SSN
    John 400-30-8745
    Mary 348-00-4093



    Table 2
    Name SSN
    John 400308745
    Mary 348004093



    What I would do is:

    Select * into Table1, Table2 where table1.ssn = table2.ssn

    However, I am unable to do so due to the formatting.

    Thxs!

    It will not replace the data in the database because it is a SELECT statement and not a DML (INSERT, UPDATE, DELETE) statement. You can also consider putting a function based on this column in table1 index to facilitate this request. However, it depends on many factors and because we do not know the versions, estimated use, how many times the table is updated, etc., we can say with certainty whether this can help or not. An example would be:

    CREATE INDEX TABLE1_SSN_FBIDX ON TABLE1(REPLACE(SSN,'-'))
    
  • Need help on the use of Partition for a SELECT statement

    -Hello everyone,
    -This my request. I'm a junior developer of the APEX.
    -database version is 11g version 4.0 apex
    DEFINE startmonth = "Aug 2012";
    DEFINE endmonth   = "Oct 2012";
    WITH  all_months  AS
    (
       SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
       ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
       from all_objects
       where
       rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
    )
    ,
    lt_event_type_a AS
    ( select event_type, active, e_id 
      from lt_event_type
      where active = 1
    )
    ,
    engagement_event_a as
    (SELECT * FROM engagement_event
     where active =1
     )
    
    select lt_ev.event_type,TO_CHAR (am.which_month, 'Mon YYYY')  AS month, count(ce.engagement_id) as monthly_events_per_event_type
      from lt_event_type_a lt_ev
      
      left join engagement_event_a ev  on
        lt_ev.event_type = ev.event_type
      
      left join court_engagement ce on
        ev.e_eng_id = ce.engagement_id
         and ce.court_name like '%' --will be filtered with a court_name parameter
     
      right join all_months am on
        ce.date_joined_court <= LAST_DAY(am.which_month) 
        and (ce.date_terminated is null or ce.date_terminated > LAST_DAY(am.which_month) )
     group by rollup(lt_ev.event_type, am.which_month)
     order by lt_ev.event_type, am.which_month ;
     
    - and the results are
     EVENT_TYPE                                         MONTH             MONTHLY_EVENTS_PER_EVENT_TYPE
    -------------------------------------------------- ----------------- -----------------------------
    Absent without leave                               Sep 2012                                      1 
    Absent without leave                               Oct 2012                                      1 
    Absent without leave                                                                             2 
    Court Appearance                                   Sep 2012                                      2 
    Court Appearance                                   Oct 2012                                      3 
    Court Appearance                                                                                 5 
    Incentive granted                                  Aug 2012                                      1 
    Incentive granted                                  Sep 2012                                      2 
    Incentive granted                                  Oct 2012                                      1 
    Incentive granted                                                                                4 
    Judicial direction                                 Oct 2012                                      1 
    Judicial direction                                                                               1 
    Police report                                      Sep 2012                                      2 
    Police report                                      Oct 2012                                      2 
    Police report                                                                                    4 
    Positive test                                      Sep 2012                                      1 
    Positive test                                      Oct 2012                                      1 
    Positive test                                                                                    2 
    Sanction imposed                                   Aug 2012                                      1 
    Sanction imposed                                   Sep 2012                                      1 
    Sanction imposed                                   Oct 2012                                      1 
    Sanction imposed                                                                                 3 
                                                                                                    21 
    
     23 rows selected 
     
    - but the condition is that I list all types of event in the search list
    -with a total number of events by event type for each month in a number of calendar months (user will select months like August 2012 or a range of month August 2012 - October 2012)
    -the query above just list all the events (see table engagement_event) that have the date_join_court and date_terminated meets the required conditions.
    -I wonder, is it possible to enumerate all types of event, then monthly for each event type with the total as
      EVENT_TYPE                                         MONTH             MONTHLY_EVENTS_PER_EVENT_TYPE
    -------------------------------------------------- ----------------- -----------------------------
    A very long long name                              Aug 2012                                      0 
    A very long long name                              Sep 2012                                      0 
    A very long long name                              Oct 2012                                      0 
    A very long long name                              Total                                           0 
    Absent without leave                               Aug 2012                                      0 
    Absent without leave                               Sep 2012                                      1 
    Absent without leave                               Oct 2012                                      1 
    Absent without leave                               Total                                         2 
    Court Appearance                                   Aug 2012                                      0 
    Court Appearance                                   Sep 2012                                      2 
    Court Appearance                                   Oct 2012                                      3 
    Court Appearance                                   Total                                         5 
    Incentive granted                                  Aug 2012                                      1 
    Incentive granted                                  Sep 2012                                      2 
    Incentive granted                                  Oct 2012                                      1 
    ......
    -I tried to use PARTTTION, but still, it does not produce the correct result,
    -Here's a version shortened the tables related to the query
    -Thank you very much in advance.
    --create lookup table for event type
     CREATE TABLE "LT_EVENT_TYPE" 
       ("E_ID" NUMBER, 
         "EVENT_TYPE" VARCHAR2(50 BYTE), 
         "DATE_CREATED" DATE, 
         "ACTIVE" NUMBER(2,0) DEFAULT 1
       ) 
    
     --create table court_engagement
      CREATE TABLE "COURT_ENGAGEMENT" 
       (     "ENGAGEMENT_ID" NUMBER, 
         "COURT_NAME" VARCHAR2(50 BYTE), 
         "DATE_REFERRED" DATE, 
         "DETERMINATION_HEARING_DATE" DATE, 
         "DATE_JOINED_COURT" DATE, 
         "DATE_TERMINATED" DATE, 
         "TERMINATION_TYPE" VARCHAR2(50 BYTE), 
         "DATE_CREATED" DATE, 
         "ACTIVE" NUMBER(2,0) DEFAULT 1, 
         "DEFENDANT_ID" NUMBER
       )
       --create table engagement_event
       CREATE TABLE "ENGAGEMENT_EVENT" 
       (     "EVENT_ID" NUMBER, 
         "E_ENG_ID" NUMBER, 
         "EVENT_TYPE" VARCHAR2(50 BYTE), 
         "START_DATE" DATE, 
         "END_DATE" DATE, 
         "RELATED_SERVICE_ID" NUMBER, 
         "DATE_CREATED" DATE, 
         "ACTIVE" NUMBER(2,0)
       )
    -------
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (9,'A very long long name',to_date('02/11/12','DD/MM/RR'),0);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (6,'Excellent performance',to_date('27/09/12','DD/MM/RR'),1);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (7,'Sanction imposed',to_date('27/09/12','DD/MM/RR'),1);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (8,'Incentive granted',to_date('27/09/12','DD/MM/RR'),1);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (2,'Police report',to_date('25/09/12','DD/MM/RR'),1);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (1,'Court Appearance',to_date('25/09/12','DD/MM/RR'),1);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (3,'Judicial direction',to_date('25/09/12','DD/MM/RR'),1);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (4,'Positive test',to_date('25/09/12','DD/MM/RR'),1);
    Insert into LT_EVENT_TYPE (E_ID,EVENT_TYPE,DATE_CREATED,ACTIVE) values (5,'Absent without leave',to_date('27/09/12','DD/MM/RR'),1);
    ----------
       
    REM INSERTING into COURT_ENGAGEMENT
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (13,'BBB',null,null,to_date('01/09/12','DD/MM/RR'),to_date('14/09/12','DD/MM/RR'),'Graduated',to_date('03/10/12','DD/MM/RR'),1,4);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (16,'BBB',null,null,to_date('15/09/12','DD/MM/RR'),to_date('07/11/12','DD/MM/RR'),'Did not Graduate',to_date('04/10/12','DD/MM/RR'),1,4);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (20,'AAA',null,null,to_date('07/10/12','DD/MM/RR'),null,'Did not Graduate',to_date('08/10/12','DD/MM/RR'),1,10);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (30,'BBB',null,null,to_date('04/09/12','DD/MM/RR'),null,null,to_date('05/11/12','DD/MM/RR'),1,19);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (21,'AAA',null,null,to_date('07/10/12','DD/MM/RR'),null,null,to_date('10/10/12','DD/MM/RR'),1,11);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (15,'AAA',null,null,to_date('02/10/12','DD/MM/RR'),null,null,to_date('03/10/12','DD/MM/RR'),1,3);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (23,'AAA',null,to_date('30/09/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,null,to_date('15/10/12','DD/MM/RR'),1,8);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (25,'AAA',null,to_date('10/10/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),null,null,to_date('18/10/12','DD/MM/RR'),1,15);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (27,'AAA',null,to_date('11/09/12','DD/MM/RR'),to_date('19/07/12','DD/MM/RR'),null,null,to_date('23/10/12','DD/MM/RR'),1,16);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (2,'BBB',to_date('01/10/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,'Did not Graduate',to_date('27/09/12','DD/MM/RR'),1,2);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (28,'AAA',null,to_date('03/10/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),null,null,to_date('24/10/12','DD/MM/RR'),1,17);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (17,'AAA',null,null,to_date('08/10/12','DD/MM/RR'),to_date('11/10/12','DD/MM/RR'),'Did not Graduate',to_date('04/10/12','DD/MM/RR'),1,6);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (18,'AAA',null,null,to_date('03/09/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),'Graduated',to_date('05/10/12','DD/MM/RR'),1,7);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (19,'BBB',null,null,to_date('01/10/12','DD/MM/RR'),to_date('09/10/12','DD/MM/RR'),'Graduated',to_date('05/10/12','DD/MM/RR'),1,9);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (22,'AAA',null,null,null,null,null,to_date('11/10/12','DD/MM/RR'),1,12);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (24,'AAA',to_date('08/10/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),to_date('04/10/11','DD/MM/RR'),null,'GangNam Style',to_date('17/10/12','DD/MM/RR'),1,14);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (26,'BBB',null,to_date('17/10/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),null,null,to_date('18/10/12','DD/MM/RR'),1,7);
    Insert into COURT_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TERMINATED,TERMINATION_TYPE,DATE_CREATED,ACTIVE,DEFENDANT_ID) values (29,'AAA',null,null,to_date('20/09/12','DD/MM/RR'),null,'GangNam Style',to_date('30/10/12','DD/MM/RR'),1,18);
    
    ---------------
    REM INSERTING into ENGAGEMENT_EVENT
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (8,18,'Incentive granted',to_date('01/10/12','DD/MM/RR'),null,null,to_date('05/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (21,2,'Police report',to_date('20/09/12','DD/MM/RR'),to_date('02/10/12','DD/MM/RR'),null,to_date('24/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (7,2,'Court Appearance',to_date('02/10/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),12,to_date('03/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (11,19,'Court Appearance',to_date('02/10/12','DD/MM/RR'),null,null,to_date('05/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (13,21,'Court Appearance',to_date('01/10/12','DD/MM/RR'),to_date('11/10/12','DD/MM/RR'),null,to_date('10/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (18,24,'Incentive granted',to_date('01/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),null,to_date('17/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (20,2,'Police report',to_date('16/09/12','DD/MM/RR'),to_date('18/09/12','DD/MM/RR'),10,to_date('23/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (24,17,'Court Appearance',to_date('16/10/12','DD/MM/RR'),null,null,to_date('25/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (26,30,'Judicial direction',to_date('01/10/12','DD/MM/RR'),null,null,to_date('06/11/12','DD/MM/RR'),0);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (9,2,'Court Appearance',to_date('01/09/12','DD/MM/RR'),to_date('15/09/12','DD/MM/RR'),10,to_date('05/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (12,20,'Judicial direction',to_date('07/10/12','DD/MM/RR'),null,null,to_date('08/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (17,24,'Sanction imposed',to_date('16/10/12','DD/MM/RR'),to_date('31/10/12','DD/MM/RR'),null,to_date('17/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (23,13,'Court Appearance',to_date('01/10/12','DD/MM/RR'),null,34,to_date('24/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (5,2,'Positive test',to_date('01/10/12','DD/MM/RR'),to_date('10/10/12','DD/MM/RR'),1,to_date('02/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (10,19,'Judicial direction',to_date('01/10/12','DD/MM/RR'),null,null,to_date('05/10/12','DD/MM/RR'),1);
    Insert into ENGAGEMENT_EVENT (EVENT_ID,E_ENG_ID,EVENT_TYPE,START_DATE,END_DATE,RELATED_SERVICE_ID,DATE_CREATED,ACTIVE) values (19,25,'Absent without leave',to_date('18/10/12','DD/MM/RR'),null,null,to_date('18/10/12','DD/MM/RR'),1);
    -Thanks for reading this.

    Ann

    Please give sample data and expected results.

    Hope below is what you'd expect - yet, I would like to ask a clarification - you have a filter 'where active = 1.
    And yet, you want these types in the output. I commented on this to my query filter.
    You can change accordingly

    WITH  all_months  AS
    (
       SELECT ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM-1) AS which_month
       ,      ADD_MONTHS(to_date('&startmonth','MON YYYY'), ROWNUM  ) AS next_month
       from all_objects
       where
       rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
    )
    ,
    lt_event_type_a AS
    ( select event_type, which_month,next_month
      from lt_event_type, all_months
      --where active = 1
    )
    ,
    engagement_event_a as
    (SELECT * FROM engagement_event
     where active =1
     )
    
    select lt_ev.event_type,TO_CHAR (lt_ev.which_month, 'Mon YYYY')  AS month,
          count(ce.engagement_id) as monthly_events_per_event_type
      from engagement_event_a ev
      left outer join court_engagement ce on
       ( ev.e_eng_id = ce.engagement_id
            and ce.court_name like '%' )
      right outer join lt_event_type_a lt_ev   on
        (ce.date_joined_court <= LAST_DAY(lt_ev.which_month)
        and (ce.date_terminated is null or ce.date_terminated > LAST_DAY(lt_ev.which_month) )
        and lt_ev.event_type = ev.event_type
        )
     group by rollup(lt_ev.event_type, lt_ev.which_month)
     order by lt_ev.event_type, lt_ev.which_month ;
    
    EVENT_TYPE                                         MONTH    MONTHLY_EVENTS_PER_EVENT_TYPE
    -------------------------------------------------- -------- -----------------------------
    A very long long name                              Aug 2012                             0
    A very long long name                              Sep 2012                             0
    A very long long name                              Oct 2012                             0
    A very long long name                                                                   0
    Absent without leave                               Aug 2012                             0
    Absent without leave                               Sep 2012                             1
    Absent without leave                               Oct 2012                             1
    Absent without leave                                                                    2
    Court Appearance                                   Aug 2012                             0
    Court Appearance                                   Sep 2012                             2
    Court Appearance                                   Oct 2012                             3
    Court Appearance                                                                        5
    Excellent performance                              Aug 2012                             0
    Excellent performance                              Sep 2012                             0
    Excellent performance                              Oct 2012                             0
    Excellent performance                                                                   0
    Incentive granted                                  Aug 2012                             1
    Incentive granted                                  Sep 2012                             2
    Incentive granted                                  Oct 2012                             1
    Incentive granted                                                                       4
    Judicial direction                                 Aug 2012                             0
    Judicial direction                                 Sep 2012                             0
    Judicial direction                                 Oct 2012                             1
    Judicial direction                                                                      1
    Police report                                      Aug 2012                             0
    Police report                                      Sep 2012                             2
    Police report                                      Oct 2012                             2
    Police report                                                                           4
    Positive test                                      Aug 2012                             0
    Positive test                                      Sep 2012                             1
    Positive test                                      Oct 2012                             1
    Positive test                                                                           2
    Sanction imposed                                   Aug 2012                             1
    Sanction imposed                                   Sep 2012                             1
    Sanction imposed                                   Oct 2012                             1
    Sanction imposed                                                                        3
                                                                                           21 
    
     37 rows selected 
    
  • Menu Module v2 supported for the selected state?

    I can't understand if v2 menu module supports the selected state. I remember reading somewhere that it was planned to produce in the future, but it seems that the file /ModuleTemplates/Menu/Default/container.html has accommodations for her.

    A resource if so, it would be appreciated.

    By default I did, the JavaScript code is there in the updates page and not different from the normal version in this respect.

  • Add more than 2 lines for a select statement without inserting rows in the base table

    Hi all

    I have a below a simple select statement that is querying a table.

    Select * from STUDY_SCHED_INTERVAL_TEMP
    where STUDY_KEY = 1063;

    but here's the situation. As you can see its return 7 ranks. But I must add
    2 rows more... with everything else, default or what exist... except the adding more than 2 lines.
    I can't insert in the base table. I want my results to end incrementing by 2 days in
    measurement_date_Taken on 01-APR-09... so big measurement_date_taken expected to
    end at study_end_Date...



    IS IT STILL POSSIBLE WITHOUT INSERT ROWS IN THE TABLE AND PLAYIHY ALL AROUND WITH
    THE SELECT STATEMENT?

    Sorry if this is confusing... I'm on 10.2.0.3

    Published by: S2K on August 13, 2009 14:19

    Well, I don't know if this request is as beautiful as my lawn, but seems to work even when ;)
    I used the "simplified" version, but the principle should work for your table, S2K.
    As Frank has already pointed out (and I fell on it while clunging): simply select your already existing lines and union them with the 'missing documents', you calculate the number of days that you are "missing" based on the study_end_date:

    MHO%xe> alter session set nls_date_language='AMERICAN';
    
    Sessie is gewijzigd.
    
    Verstreken: 00:00:00.01
    MHO%xe> with t as ( -- generating your data here, simplified by me due to cat and lawn
      2  select 1063 study_key
      3  ,      to_date('01-MAR-09', 'dd-mon-rr') phase_start_date
      4  ,      to_date('02-MAR-09', 'dd-mon-rr') measurement_date_taken
      5  ,      to_date('01-APR-09', 'dd-mon-rr') study_end_date
      6  from dual union all
      7  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('04-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
      8  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('09-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
      9  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('14-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
     10  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('19-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
     11  select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('23-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
     12  select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('30-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual
     13  ) -- actual query:
     14  select study_key
     15  ,      phase_start_date
     16  ,      measurement_date_taken
     17  ,      study_end_date
     18  from   t
     19  union all
     20  select study_key
     21  ,      phase_start_date
     22  ,      measurement_date_taken + level -- or rownum
     23  ,      study_end_date
     24  from ( select study_key
     25         ,      phase_start_date
     26         ,      measurement_date_taken
     27         ,      study_end_date
     28         ,      add_up
     29         from (
     30                select study_key
     31                ,      phase_start_date
     32                ,      measurement_date_taken
     33                ,      study_end_date
     34                ,      study_end_date - max(measurement_date_taken) over (partition by study_key
     35                                                                          order by measurement_date_taken ) add_up
     36                ,      lead(measurement_date_taken) over (partition by study_key
     37                                                          order by measurement_date_taken ) last_rec
     38                from   t
     39              )
     40         where last_rec is null
     41       )
     42  where rownum <= add_up
     43  connect by level <= add_up;
    
     STUDY_KEY PHASE_START_DATE    MEASUREMENT_DATE_TA STUDY_END_DATE
    ---------- ------------------- ------------------- -------------------
          1063 01-03-2009 00:00:00 02-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 04-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 09-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 14-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 19-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 23-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 30-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 31-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 01-04-2009 00:00:00 01-04-2009 00:00:00
    
    9 rijen zijn geselecteerd.
    

    Is there a simpler way (in SQL), I hope that others join, and share their ideas/example/thoughts.
    I feel that it is using more resources there.
    But I have to cut the daisies before now, they interfere my 'grass-green-ess";)

  • Creating a table using the Select statement of the physical layer

    Hello

    I use 10G, and I have the sub query in my physical layer. I chose the type of Table as Select and gave the SQL below. When I say the number of lines of update updates lines 93, that is correct, but does not show me the columns, or when I say display data, it does not show me the data, please see if I'm doing something worng. Thanks for your time and your help.

    Select (select program_id, project, actvty_id, commitment_date, row_number() over (partition by order project by commitment_date desc) as rnk project, actvty_id, program_id, commitment_date)
    of project_detail) a
    where rnk = 1

    Yes, create columns individually and click view data, you'll be able to get data

  • create view force executes a select statement

    I have the following script, which is called during the installation as a user the_owner with @Code\Views\VW_TODO. from sqlplus
    Prompt View VW_TODO;
    
    CREATE OR REPLACE FORCE VIEW the_owner.VW_TODO (THE_ID, COUNT) AS
    --+============================================================================
    -- Project Code:  
    -- Project Name:  
    -- Module Type:   View
    -- Change History:
    --
    -- Name                 Version  Date        Comment
    --
    -- =============================================================================
    
         SELECT   the_id, COUNT ( * ) COUNT
           FROM   the_owner.todo_list
          WHERE   completed IS NULL
       GROUP BY   the_id;
    /
    I get the following output in my journal...
    View VW_TODO
    
    no rows selected
    
    
    no rows selected
    I have tried with and without the trailing slash and the final semicolon... no work...
    When I run SQL Developer, it creates the view.
    Can someone tell me why?

    Thanks in advance,
    Gus...

    Gus,

    It seems that you have a completely empty line in your CREATE VIEW statement. This will cause the statement fails. If please remove this line and try again.

    Andy

  • How to create a sequence within a select statement

    I have the following query
    select 
    t.id_trato2 as DEAL_ID, --
    1 as SEQ_NO
    from treats t
    order by id_trato2, seq_no
    He will return for example

    id_trato2 seq_no
    1 s
    1 s
    4 1
    4 1
    4 1

    I need to return

    id_trato2 seq_no
    1 s
    3 2
    4 1
    1 W
    4 3

    Can how I do this?

    Try this:

    select t.id_trato2 as DEAL_ID, row_number() over (partition by t.id_trato2 order by t.id_trato2) as SEQ_NO
    from treats t
    order by 1, 2
    

    Published by: kendenny on November 23, 2010 11:40

  • Details by e-mail to the people found in the select statement

    Hello

    I managed to send me an e-mail to test base for the first time.

    However, I now require a method to be found via a SQL select with their information only email people.

    for example, select statement returns the details below: -.

    NAME OF APPLICATION DETAILS
    Fred.Bloggs request2 details
    Fred.Bloggs request4 details
    Jim.Blair request3 details

    I should concatenate the field IE @company.com

    so

    [email protected] receiving an email
    "request2 details" completed
    "request4 details" completed

    and

    [email protected] receiving an email
    "Details of the request3" completed

    I need help for the loop enter the full e-mail address of each person, and then send them only their data.

    Thanks in advance for your help.

    Wire UPDATE with news (previously the report erroneously) select sql statement

    your Reported

    Published by: user11962502 on December 1st, 2009 01:56

    Published by: user11962502 on December 1st, 2009 02:02

    Hello
    I don't have easy access to an Oracle instance to check it works and get the syntax right right right now but my first reaction would be to use a combination of rpad() and width as the column to be constant. This can be a you hard-code (IE, if you know what type of query will always say less than 8 characters) or ideally, first select the maximum length of the table:

    SELECT MAX(LENGTH(request)) + 3  INTO l_max_length FROM my_table WHERE clauses;
    /*Added the three to give a bit of extra space - modify to suit your needs*/
    

    Then when you are out of the field, do something like:

    message:=message || rpad(i.request,l_max_length - LENGTH(i.request));
    

    This will ensure that everything is aligned. Of course, it only works if the email is sent in plain text and that the user is using a font to width fixed to read emails in plain text. Most people do, but do not count on it.
    As before, the other option is to use an HTML table, however HTML emails are not very nice - try to stick with the plaintext if possible! :)

  • DDL lock on the object in a SELECT statement?

    Environment:

    Oracle 11.2.0.4 EE on Solaris

    My client called me when she was trying to create a new index on a table and the process was just hanging.  Also, she was not able to DELETE an existing index on the same table, which deal with hang them as well.

    After reviewing the advice DBA_DDL_LOCKS, I found a DDL lock on the target of the index table.

    The DDL lock is held by a process doing a SELECT on the table and this process worked for several hours.

    There was no entry in V$ LOCKED_OBJECTS for the table.

    I don't know, yet, what other operations prior to the SELECT statement in the offending process, I have not heard of the user yet.

    I realize a DDL lock is placed on objects to prevent changes while specific operations are directed against this object, i.e. the DROP, UPDATE, compile the PACKAGE, etc.

    Question: Is a select also place a DDL lock on a table at a level that would avoid a new index is created or an existing index having fallen?

    Thank you very much for your comments!

    Any reference to the resolution is greatly appreciated.

    I searched some Concepts Developers Guide, SQL, even Google reference Guide.

    -gary

    > My question is now, this lock persists for the duration of the running query?

    Easy enough to show that it is not.

    Session1:

    SQL> create table foo(bar number);     
    
    Table created.                         
    
    SQL> insert into foo values(1);       
    
    1 row created.                         
    
    SQL> commit;                           
    
    Commit complete.                       
    
    SQL> variable x refcursor
    SQL> variable a number
    SQL> begin
      2  open :X for select bar from foo;
      3  end;
      4  /                                 
    
    PL/SQL procedure successfully completed.
    

    Session 2:

    SQL> drop table foo;
    
    Table dropped.     
    

    Note that I was able to remove the table even if select is still 'in progress' - the cursor is open.

    If you really want to blow your mind, go back to the session 1:

    SQL> begin
      2  fetch :X into :a;
      3  end;
      4  /                                
    
    PL/SQL procedure successfully completed.
    
    SQL> print a                          
    
             A
    ----------
             1       
    

    The picture has gone, but I can always look for him. However, try again:

    SQL> /
    begin
    *
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00942: table or view does not exist          
    

    Note that the forum software is stupid. is: followed by x. seems it's really important to have a smiley to lovey eyes in a technical forum.

    Edit - and when you format the SQL code, it is removed completely and render invisible... silly.

    I edited my code to use: X and the problem disappeared...

  • create the code lock for computer book note

    How to create the code lock for computer book notices

    Enter the BIOS, select the Security tab and set the power on password.

    I strongly recommend that you write the power on password and put somewhere safe. If you have forgotten the password turned on, you will find that you will need to send your laptop to be repaired by HP. This is not free of cost. Once a button inside the laptop password reset are over.

    I can't be more precise, as you have not identified your laptop with its full product name or product number.

  • executes a select statement, each minute for half an hour

    Hi all

    I want to run a SELECT statement on a table every minute for half an hour.

    Something like this:

    Begin

    Do all the 1 minute for 30 Min

    Select col1, col2 from mytable

    End

    I thought about PL/SQL loop. But no matter what example with timekeeping.

    I don't care?

    Thank you and best regards.

    Hello

    As John said, you can use DBMS_SCHEDULER for this. That being said, you just can't run a query and do nothing with its result. You must do something with it.

    Here is an example showing how to create a task that runs every minute for a total of 30 min

    BEGIN

    DBMS_SCHEDULER. Create_Job (job_name-online 'MY_JOB',

    job_type-online "PLSQL_BLOCK."

    job_action => ' DECLARE val1 number; val2 number; BEGIN SELECT 1, 2 INTO val1, val2 FROM DUAL; END;',

    start_date => SYSDATE,

    End_date => SYSDATE + 30 /(24*60),

    repeat_interval => ' FREQ = MINUTELY ",

    auto_drop => TRUE,

    enabled-TRUE online

    );

    END;

    /

    It will start immediately and end 30 minutes later (it will be automatically abandoned). As you can see, the result of the query is placed in the variables. Thus, this work is useless.

Maybe you are looking for

  • Want dv7 7223 cl: System disabled

    I just got my laptop back the pawn shop and I have a disabled system messge that comes up when I try to start the computer. The message says system 79377446 disabledThe model is a dv7 7223 cl desireI appreciate all the answers

  • Stop the pictures of the opening when I plugin my iPhone.

    I am so sick and tired of having to close the pictures whenever I try to charge my iPhone on my Mac Air. I think it's a bad idea because if I have friends over then I'll charge my phone and all sudden embarrassing photos emerge because I wasn't fast

  • Newbie question: How do I loop to stop when the weather changes?

    I'm using a 'chain of Date/Time Format vi"with a time format string % H: %m, I want time to stop a loop when the minute is changed. How should I do tjis? See you soon,. Sam

  • FILE EXPLORER Windows 10 does not work

    I upgraded from windows 7 Home Windows 10. Everything worked for three months. Now my file manager does not work. If I double click on a shortcut, nothing happens. No message or errors, no feedback at all. If I select file from the menu 10 windows Ex

  • Updated 1.4 and cannot install apps.

    I upgraded to 1.4 and everything seems to work fine, except that I can't install apps on the phone. All my previously downloaded apps are missing. If I check in my Application of the App Catalog section, it says "you have not installed applications.