The combination of several tables: patent wise associates to a given laboratory

Oracle 10g

Ask your help to rewrite the query below correctly

I have the following tables
CREATE TABLE  "ADDLAB" 
   (     "VERSIONNO" NUMBER(*,0), 
     "LABID" VARCHAR2(20), 
     "LABNAME" VARCHAR2(60), 
     "LABSTARTDATE" DATE, 
     "LABSTATUS" VARCHAR2(20), 
     "LABENDDATE" DATE, 
     "OPERATOR" VARCHAR2(20), 
     "FROMDATE" DATE, 
     "TODATE" DATE, 
     "SRCHFIELD" VARCHAR2(20), 
     "PARENTLABID" VARCHAR2(20), 
     "LABCLOSEREASON" VARCHAR2(1000), 
     "LABHIDDENDATE" VARCHAR2(20), 
      CONSTRAINT "PK_B34" PRIMARY KEY ("LABID", "LABHIDDENDATE") ENABLE
   )

CREATE TABLE  "ADDPROJECT" 
   (     "VERSIONNO" NUMBER(*,0), 
     "PROJID" VARCHAR2(20), 
     "PROJNAME" VARCHAR2(60), 
     "PROJSTARTDATE" DATE, 
     "PROJSTATUS" VARCHAR2(20), 
     "PROJENDDATE" DATE, 
     "PROJENDTYPE" VARCHAR2(20), 
     "PROJENDREASON" VARCHAR2(1000), 
     "UCPROJECTMANAGER" VARCHAR2(20), 
     "FROMDATE" DATE, 
     "TODATE" DATE, 
     "SRCHFIELD" VARCHAR2(20), 
     "OPERATOR" VARCHAR2(20), 
     "PARENTPROJID" VARCHAR2(20), 
     "PROJHIDDENDATE" VARCHAR2(20), 
      CONSTRAINT "PK_B36" PRIMARY KEY ("PROJID", "PROJHIDDENDATE") ENABLE
   )

CREATE TABLE  "PROJECTTOLABASSOCIATION" 
   (     "VERSIONNO" NUMBER(*,0), 
     "PROJLABASSOID" NUMBER(9,0), 
     "PROJID" VARCHAR2(20), 
     "LABID" VARCHAR2(20), 
     "PROJLABSTARTDATE" DATE, 
     "STATUS" VARCHAR2(20), 
     "ENDDATE" DATE, 
     "LABHIDDENDATE" VARCHAR2(20), 
     "PROJLABHIDDENDATE" VARCHAR2(20), 
     "PROJHIDDENDATE" VARCHAR2(20), 
      CONSTRAINT "PK_B37" PRIMARY KEY ("LABID", "PROJID", "PROJLABHIDDENDATE") ENABLE
   )

CREATE TABLE  "ADDPATENT" 
   (     "VERSIONNO" NUMBER(*,0), 
     "PATID" NUMBER(9,0), 
     "PATTITLE" VARCHAR2(250), 
     "PATSTATUS" VARCHAR2(20), 
     "PATAPPDATE" DATE, 
     "PATSTATUSDATE" DATE, 
     "PATENTREJECTWITHDRAWNREASON" VARCHAR2(1000), 
     "PATNO" VARCHAR2(20), 
     "SRCHFIELD" VARCHAR2(20), 
     "FROMDATE" DATE, 
     "TODATE" DATE, 
     "OPERATOR" VARCHAR2(20), 
     "PATENTGEOGRAPHY" VARCHAR2(20), 
     "PAPERTYPE" VARCHAR2(20) DEFAULT 'dummy', 
     "PATENTURL" VARCHAR2(200), 
      CONSTRAINT "PK_A67" PRIMARY KEY ("PATID") ENABLE, 
      CONSTRAINT "UQ_PATENTTITLE" UNIQUE ("PATTITLE") ENABLE
   )

CREATE TABLE  "PATENTTOPROJECTASSOCIATION" 
   (     "VERSIONNO" NUMBER(*,0), 
     "PATENTPROJASSOID" NUMBER(9,0), 
     "PATID" NUMBER(9,0), 
     "PROJID" VARCHAR2(20), 
     "PATENTPROJHIDDENDATE" VARCHAR2(20), 
     "STATUS" VARCHAR2(20), 
     "STARTDATE" DATE, 
     "ENDDATE" DATE, 
     "PROJHIDDENDATE" VARCHAR2(20), 
      CONSTRAINT "PK_A91" PRIMARY KEY ("PATID", "PROJID", "PATENTPROJHIDDENDATE") ENABLE
   )

CREATE TABLE  "PATENTASSOCIATES" 
   (     "VERSIONNO" NUMBER(*,0), 
     "PATASSOID" NUMBER(9,0), 
     "PATID" NUMBER(9,0), 
     "ASSOCIATEID" NUMBER(9,0), 
      CONSTRAINT "PK_B67" PRIMARY KEY ("ASSOCIATEID", "PATID") ENABLE
   )

CREATE TABLE  "ADDASSOCIATE" 
   (     "VERSIONNO" NUMBER(*,0), 
     "ASSOCIATEID" NUMBER(9,0) NOT NULL ENABLE, 
     "ASSOCIATENAME" VARCHAR2(100) NOT NULL ENABLE, 
     "CTOJOINDATE" DATE, 
     "STATUS" VARCHAR2(20), 
     "ENDDATE" DATE, 
     "SRCHFIELD" VARCHAR2(20), 
     "OPERATOR" VARCHAR2(20), 
     "FROMDATE" DATE, 
     "TODATE" DATE, 
      CONSTRAINT "PK_B23" PRIMARY KEY ("ASSOCIATEID") ENABLE
   )
Now, I need a list of all patents sage associates for each laboratory.
I have wirtten the following query. If I get the correct results, I get duplicate values. Each record is displayed at least 10 times. So if there are 4 partners for a given patent, it's ateleast back 40 records. I tried SINGLE. No results displayed.
query2 = "SELECT tn1.associateName AS name " +
"FROM AddLab al, AddProject ap, AddPatent p, ProjecttoLabAssociation pl, PatenttoProjectAssociation pp, " +
"AddAssociate tn1, PatentAssociates tn2 " + 
"WHERE " +
"al.labID=pl.labID " + 
"AND ap.projID=pl.projID " +
"AND pl.projID=pp.projID " +
"AND p.patID=pp.patID " +
"AND pl.status = 'Active' " +
"AND tn1.associateID = tn2.associateID " +
"AND tn2.patID = '" + rs.getString("patID") + "' " +
"order by al.labID";

try
{
stmt = conn.createStatement();
rs2 = stmt.executeQuery(query2);
String associateNames = "";
                                        
while(rs2.next())
{
 associateNames += rs2.getString("ID") + ";\n";
}

Use the laureline or

Use can use the the tn1.associateName group

It seems that your use within java code here, I formatted as sql code. Fomat according to your requirement

SELECT t.name FROM (SELECT tn1.associateName AS name,count(*)
FROM AddLab al, AddProject ap, AddPatent p, ProjecttoLabAssociation pl, PatenttoProjectAssociation pp,
AddAssociate tn1, PatentAssociates tn2
WHERE
al.labID=pl.labID
AND ap.projID=pl.projID
AND pl.projID=pp.projID
AND p.patID=pp.patID
AND pl.status = 'Active'
AND tn1.associateID = tn2.associateID
AND tn2.patID = '  rs.getString(patID)  '
GROUP BY tn1.associateName
order by al.labID) t;

Tags: Database

Similar Questions

  • create the view of several tables of days

    Hello
    I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
    Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
    I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?

    You will appreciate comments on the details and the whole concept. I have prev sql server experience.

    Thank you
    T

    user12943718 wrote:
    Hello
    I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
    Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
    I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?

    You will appreciate comments on the details and the whole concept. I have prev sql server experience.

    Thank you
    T

    Change the data model if you have 1 table for a day.

    You have just a DATA table and a column to indicate the day of the application.

    Then you don't need a view, do not need anything dynamic, do not need to break your head against a wall for a simple query... etc.

  • How to extract the indictments of several tables

    Hi all

    I have 10 tables that all have the same columns, but different data in each column. I would like to get a count of how many fields is not null for a specific column in each table. I tried to figure this out for hours without success. We use oracle 10g and I use Toad to write my SQL.

    I will try to give you an example.

    The SQL below returns the numbers for one of the tables. I would like to get the counts for each table with a single query.

    SELECT COUNT(*) FROM RRM_HOME_EQ
     WHERE unit_id is not null
     AND   account_off is not null;
    

    Thanks in advance

    OR

    Try as below...

    Select (select count (*) from emp where deptno = 10) tab1, tab2 (select count (*) of the Department)

    Double;

    TAB1 TAB2

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

    3          7

    Hope this helps... !

  • The combination of several lines to line of monkey through SQL Stmt

    Hello

    I try to combine the values returned by several rows in a row,
    through indoor/outdoor sql or any optimally.
    In the example, I would like to have name, surname, email and phone to be
    returned in a single line.
    create table TEMP_AAAAA
    (
      FIRST_NAME VARCHAR2(25),
      LAST_NAME  VARCHAR2(25),
      CON_METHOD VARCHAR2(25),
      CON_VALUE  VARCHAR2(25)
    
    )
    
    INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','EMAIL','[email protected]');
    INSERT INTO TEMP_AAAAA VALUES('TOM','MAC','PHONE','12345');
    Any suggestion to do this through sql stmt.
    I did it through pl/sql, I wondered if it could be realized only thru SQL Stmt
    DECLARE
    v_FIRST_NAME  VARCHAR2(25);
    v_SECOND_NAME VARCHAR2(25);
    v_EMAIL       VARCHAR2(25);
    v_PHONE       VARCHAR2(25);
    BEGIN
    v_FIRST_NAME := NULL;
    v_SECOND_NAME := NULL;
    v_EMAIL := NULL;
    v_PHONE := NULL;
    
    FOR IMPL_CUR IN(SELECT * FROM TEMP_AAAAA ORDER BY CON_METHOD DESC)
    LOOP
    
            IF v_FIRST_NAME IS NULL
            THEN
               v_FIRST_NAME := IMPL_CUR.FIRST_NAME;
            END IF;
            IF v_SECOND_NAME IS NULL
            THEN
               v_SECOND_NAME := IMPL_CUR.LAST_NAME;
            END IF;   
            IF v_PHONE IS NULL AND IMPL_CUR.CON_METHOD = 'PHONE'
            THEN
               v_PHONE := IMPL_CUR.CON_VALUE;
            END IF;
           
            IF v_FIRST_NAME = IMPL_CUR.FIRST_NAME AND 
               v_SECOND_NAME = IMPL_CUR.LAST_NAME AND 
               length(v_PHONE) > 0 
            THEN
              IF v_EMAIL IS NULL AND IMPL_CUR.CON_METHOD = 'EMAIL'
              THEN
                 v_EMAIL := IMPL_CUR.CON_VALUE;
                 EXIT;
              END IF;        
            END IF;
            
            
            
    END LOOP;
    
                       
             DBMS_OUTPUT.put_line('firstName...:' || v_FIRST_NAME);     
             DBMS_OUTPUT.put_line('lastName....:' || v_SECOND_NAME);     
             DBMS_OUTPUT.put_line('PHONE.......:' || v_PHONE);
             DBMS_OUTPUT.put_line('EMAIL.......:' || v_EMAIL); 
    
    END;

    SELECT FIRST_NAME, LAST_NAME,
    MAX (SUBSTR (SYS_CONNECT_BY_PATH (CON_VALUE,' '), 2)) EMP_LIST
    (SELECT FIRST_NAME, LAST_NAME, CON_VALUE,
    ROW_NUMBER() OVER (PARTITION FIRST_NAME, LAST_NAME ORDER BY CON_METHOD) RN
    OF TEMP_AAAAA)
    CONNECT BY PRIOR (FIRST_NAME |) LAST_NAME. =(FIRST_NAME||) RN) LAST_NAME. (RN-1))
    START BY RN = 1
    GROUP FIRST_NAME, LAST_NAME;

    FIRST_NAME LAST_NAME EMP_LIST
    ------------------------- ------------------------- ------------------------------------------------
    TOM MAC [email protected] 12345

  • The combination of several AD ACS 4.2 security groups

    Hello

    Our ACS is used for AAA for the wireless, the IOS CLI access and access to the unix server. For net admins and administrators unix, there are two levels, so indeed, we have 5 groups of individual devices that a user can be granted access.

    User groups are defined in Active Directory.

    I am looking for a way to combine information from several AD security groups to determine what a user can access. For example, a net administrator may or may not be a unix admin as well.

    Is it possible to do other than to have to have a large number of ad groups with one for each combination of authorization privileges?

    Thank you

    Luke

    HI Luke,.

    Definition of mapping of the hybrid is the best way to achieve this.

    Kind regards

    ~ JG

    Note the useful messages

  • Join the execution of several Tables Plan

    Try to understand the query execution plan:
     
    
    HR>  SELECT e.last_name , d.department_name, l.city
      2     FROM employees e, departments d , locations l
      3     WHERE e.department_id = d.department_id
      4   AND
      5           d.location_id = l.location_id;
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1235509609
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |                  |   106 |  4346 |     9  (23)| 00:00:01 |
    |*  1 |  HASH JOIN                    |                  |   106 |  4346 |     9  (23)| 00:00:01 |
    |   2 |   MERGE JOIN                  |                  |    27 |   837 |     6  (34)| 00:00:01 |
    |   3 |    TABLE ACCESS BY INDEX ROWID| DEPARTMENTS      |    27 |   513 |     2   (0)| 00:00:01 |
    |   4 |     INDEX FULL SCAN           | DEPT_LOCATION_IX |    27 |       |     1   (0)| 00:00:01 |
    |*  5 |    SORT JOIN                  |                  |    23 |   276 |     4  (50)| 00:00:01 |
    |   6 |     VIEW                      | index$_join$_003 |    23 |   276 |     3  (34)| 00:00:01 |
    |*  7 |      HASH JOIN                |                  |       |       |            |          |
    |   8 |       INDEX FAST FULL SCAN    | LOC_CITY_IX      |    23 |   276 |     1   (0)| 00:00:01 |
    |   9 |       INDEX FAST FULL SCAN    | LOC_ID_PK        |    23 |   276 |     1   (0)| 00:00:01 |
    |  10 |   TABLE ACCESS FULL           | EMPLOYEES        |   107 |  1070 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    So he needs to MERGE between DEPARTMENTS (that has been sorted by index) JOIN and (here's the part confusing...) LOCATIONS including oracle used HASH JOIN (?) to bring the information from and then sort the opinion generated by the system that has been created...?

    Is that this HASH JOIN to step 7 only refers to a view that is generated by the system that oracle had to sort and not actually HASH JOIN
    between two tables?

    Thanks much for you patience

    Hello

    Perhaps, it helps to understand things better if we walk in the plan.

    Plans have a hierarchical structure (which is translated graphically by fingerprints). Operating needs parent all the children completed operations before it can do its job (which is generally combining lines with children in one way or another).

    Another point is that joins can have anything like their entries, tables not only. That is a hash join can join an index for an index or a table to an index, or then to join a table results of hash one another and so on and so forth.

    With this in mind, we can go back on what is happening here step by step:

    The needs of the join by hash (1) (2) and (10) to finish. (10) is a basic operation, since a table scan depends on nothing else, but merge join handset (2) (3) and (5), who both are complex operations (i.e. dependent on one or more children). Specifically, lines (3) from the DEPARTMENTS table using ROWID obtained from a full analysis of the index of DEPT_LOCATION_IX (4), (5) is simply lines join hash (7) and sorted in the order required.

    I hope this helps.

    Best regards
    Nikolai

    Published by: Nikolay Savvinov on January 26, 2012 05:26

  • The combination of several documents for double-sided printing

    Is it possible to combine several pdf documents or word to insert automatically blank pages on the documents that use odd pages, but doesn't add pages to documents whose pages even if the final combined PDF is put in place for duplex printing with the first page of each current combined to go on the front of a page?

    For example, I have 4 different PDF with different numbers of pages:

    pdf = 3 pages 001.exe (numbered a01, a02, a03)

    002 pdf = 4 pages (numbered b01, b02, b03 - b04)

    003 pdf = 5 pages (numbered c01, c02, c03 c04 c05)

    004 pdf = 3 pages (numbered d01, d02, d03)

    Page number 01 must always be on the front, but if I combine the pdf page b01 will be on the back of a03 and I have to manually insert a blank page.  This will make b01 printed on the front of page 3, which is what I want, it will also fix b02 - c05 002. PDF with an even number of pages, but d01 must print on the back of page 7 instead of the front of the 8 page because there is no blank page after 003.pdf.

    Is there a way to make acrobat recognizes the number of pages in a document and then insert a blank page automatically when it acknowledges the documents with an odd number of pages?

    If the feature/script would follow these steps:

    001.exe pdf recognized as 3 pages (numbered a01, a02, a03)

    blankpage.PDF

    002 pdf, recognized as being 4 pages (numbered b01, b02, b03 b04)

    003 pdf recognized as 5 pages (numbered c01, c02, c03 c04 c05)

    blankpage.PDF

    004 pdf, recognized as being of 3 pages (numbered d01, d02, d03)

    make the final printed output pages 9:

    A01 (front) / A02 (back) d03 a03/blank b01/b02, b03/b04, c01/c02, c03/c04, c05/blank, d01/d02

    Something like this:

    If ((this.numPages % 2) == 1) {}

    Insert a blank page

    }

  • CONNECT PRIOR TO THE HELP OF SEVERAL TABLES RETURNS AWKAWARD RESULTS.

    CREATE TABLE "JAM"."FTVORGN2"
       (    "FTVORGN_COAS_CODE" VARCHAR2(1 CHAR) NOT NULL ENABLE,
        "FTVORGN_ORGN_CODE" VARCHAR2(6 CHAR) NOT NULL ENABLE,
        "FTVORGN_EFF_DATE" DATE NOT NULL ENABLE,
        "FTVORGN_ACTIVITY_DATE" DATE NOT NULL ENABLE,
        "FTVORGN_USER_ID" VARCHAR2(30 CHAR) NOT NULL ENABLE,
        "FTVORGN_NCHG_DATE" DATE NOT NULL ENABLE,
        "FTVORGN_TERM_DATE" DATE,
        "FTVORGN_TITLE" VARCHAR2(35 CHAR) NOT NULL ENABLE,
        "FTVORGN_STATUS_IND" VARCHAR2(1 CHAR),
        "FTVORGN_ORGN_CODE_PRED" VARCHAR2(6 CHAR),
        "FTVORGN_DATA_ENTRY_IND" VARCHAR2(1 CHAR) NOT NULL ENABLE,
        "FTVORGN_VPDI_CODE" VARCHAR2(6 CHAR)
       )
    
    

    I have a table as above.

    I also have a table as below.

    CREATE TABLE "JAM"."FORUSOR"
       (    "FORUSOR_USER_ID_ENTERED" VARCHAR2(30 CHAR) NOT NULL ENABLE,
        "FORUSOR_COAS_CODE" VARCHAR2(1 CHAR) NOT NULL ENABLE,
        "FORUSOR_ORGN_CODE" VARCHAR2(6 CHAR) NOT NULL ENABLE,
        "FORUSOR_ACCESS_IND" VARCHAR2(1 CHAR) NOT NULL ENABLE,
        "FORUSOR_ACTIVITY_DATE" DATE NOT NULL ENABLE,
        "FORUSOR_USER_ID" VARCHAR2(30 CHAR) NOT NULL ENABLE,
        "FORUSOR_WBUD_ACCESS_IND" VARCHAR2(1 CHAR) NOT NULL ENABLE,
        "FORUSOR_SURROGATE_ID" NUMBER(19,0),
        "FORUSOR_VERSION" NUMBER(19,0),
        "FORUSOR_DATA_ORIGIN" VARCHAR2(30 CHAR),
        "FORUSOR_VPDI_CODE" VARCHAR2(6 CHAR)
       )
    
    
    
    
    

    REM INSERTING into FTVORGN2
    SET DEFINE OFF;
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','01',to_date('01-OCT-88','DD-MON-RR'),to_date('19-MAR-97','DD-MON-RR'),'TRAIN01',to_date('31-DEC-99','DD-MON-RR'),null,'TOTAL UNIVERSITY','A',null,'N',null);
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','1006',to_date('22-SEP-14','DD-MON-RR'),to_date('22-SEP-14','DD-MON-RR'),'MJ35',to_date('31-DEC-99','DD-MON-RR'),null,'Provost','A','01','N',null);
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','2027',to_date('01-OCT-97','DD-MON-RR'),to_date('01-OCT-97','DD-MON-RR'),'DARDARMT',to_date('31-DEC-99','DD-MON-RR'),null,'Sch of Biomed Engr, Sci Health Sys','A','1006','N',null);
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','2028',to_date('28-FEB-01','DD-MON-RR'),to_date('28-FEB-01','DD-MON-RR'),'JMOORE',to_date('31-DEC-99','DD-MON-RR'),null,'Sch of Envr Science, Engr Policy','A','1006','N',null);
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','5275',to_date('01-OCT-97','DD-MON-RR'),to_date('02-JUL-99','DD-MON-RR'),'JMOORE',to_date('31-DEC-99','DD-MON-RR'),null,'Administration','A','1006','N',null);
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','5325',to_date('01-OCT-97','DD-MON-RR'),to_date('13-JAN-00','DD-MON-RR'),'JMOORE',to_date('31-DEC-99','DD-MON-RR'),null,'Enrollment & Career Management','A','1006','N',null);
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','5350',to_date('01-OCT-97','DD-MON-RR'),to_date('02-JUL-99','DD-MON-RR'),'JMOORE',to_date('31-DEC-99','DD-MON-RR'),null,'Office of Education','A','1006','N',null);
    Insert into FTVORGN2 (FTVORGN_COAS_CODE,FTVORGN_ORGN_CODE,FTVORGN_EFF_DATE,FTVORGN_ACTIVITY_DATE,FTVORGN_USER_ID,FTVORGN_NCHG_DATE,FTVORGN_TERM_DATE,FTVORGN_TITLE,FTVORGN_STATUS_IND,FTVORGN_ORGN_CODE_PRED,FTVORGN_DATA_ENTRY_IND,FTVORGN_VPDI_CODE) values ('D','5365',to_date('01-OCT-97','DD-MON-RR'),to_date('02-JUL-99','DD-MON-RR'),'JMOORE',to_date('31-DEC-99','DD-MON-RR'),null,'Library','A','1006','N',null);
    
    

    Spend four years of revenues (to make the query work)

    with

    ftvorgn2 as

    (select would be ' ftvorgn_coas_code,)

    '01' ftvorgn_orgn_code,

    to_date('01-Oct-1988','DD-mon-YYYY') ftvorgn_eff_date,

    to_date('19-Mar-1997','DD-mon-YYYY') ftvorgn_activity_date,

    'TRAIN01' ftvorgn_user_id,

    to_date('31-Dec-2099','DD-mon-YYYY') ftvorgn_nchg_date,

    ftvorgn_term_date null,

    Ftvorgn_title "UNIVERSITY TOTAL."

    "A' ftvorgn_status_ind,.

    ftvorgn_orgn_code_pred null,

    ' Ftvorgn_data_entry_ind,

    ftvorgn_vpdi_code null

    of the double

    Union of all the

    Select would be ', '1006', to_date (22-SEP-2014 "," DD-MON-YYYY '), to_date (22-SEP-2014 "," DD-MON-YYYY '), 'MJ35', to_date (December 31, 2099 ',' MON-DD-YYYY ""), null, 'Grand', 'A', ' 01 ',' n, null of union double all the

    Select would be ', '2027', to_date (October 1, 1997 "," DD-MON-YYYY '), to_date (October 1, 1997 "," DD-MON-YYYY '), 'DARDARMT', to_date (December 31, 2099 ',' MON-DD-YYYY ""), null, "Sch of Biomed Engr, Sci health Sys', 'A','1006, ', null of union double all the»

    Select would be ', '2028', to_date (February 28, 2001 "," DD-MON-YYYY '), to_date (February 28, 2001 "," DD-MON-YYYY '), 'JMOORE', to_date (December 31, 2099 ',' MON-DD-YYYY ""), null, "Sch of Envr Science, political Engr, 'A', '1006', ', null of union double all the

    Select would be ', '5275', to_date (October 1, 1997 "," DD-MON-YYYY '), to_date (July 2, 1999 "," DD-MON-YYYY '), 'JMOORE', to_date (December 31, 2099 ',' MON-DD-YYYY ""), null, 'Administration', 'A', "1006", "n", union null double all the

    Select would be ', '5325', to_date (October 1, 1997 "," DD-MON-YYYY '), to_date (January 13, 2000 "," DD-MON-YYYY '), 'JMOORE', to_date (December 31, 2099 ',' MON-DD-YYYY ""), null, 'The registration management & career', 'A', '1006', ', null of union double all the

    Select would be ', '5350', to_date (October 1, 1997 "," DD-MON-YYYY '), to_date (July 2, 1999 "," DD-MON-YYYY '), 'JMOORE', to_date (December 31, 2099 ',' MON-DD-YYYY ""), null, "Office of Education", 'A', '1006', ', null of union double all the

    Select would be ', '5365', to_date (October 1, 1997 "," DD-MON-YYYY '), to_date (July 2, 1999 "," DD-MON-YYYY '), 'JMOORE', to_date (December 31, 2099 ',' MON-DD-YYYY ""), null, 'Library', 'A', "1006", "n", the double null

    ),

    forusor as

    (select 'jam337' forusor_user_id_entered,

    A ' forusor_coas_code,.

    "1006 ' forusor_orgn_code,

    'B' forusor_access_ind,

    to_date('01-Aug-12','DD-mon-RR') forusor_activity_date,

    'P' forusor_user_id,

    ' Forusor_wbud_access_ind,

    forusor_surrogate_id null,

    forusor_version null,

    forusor_data_origin null,

    forusor_vpdi_code null

    of the double

    Union of all the

    Select 'jam337', ', '1007',' B', to_date (August 1, 2012 ',' MON-DD-YYYY'), 'P', null, null, ' n, null, null from union double all the

    Select 'jam337', ', '1011',' B', to_date (August 1, 2012 ',' MON-DD-YYYY'), 'P', null, null, ' n, null, null from union double all the

    Select 'jam337', ', '1026', 'Q', to_date (January 30, 2008 "," MON-DD-YYYY'), 'P', null, null, ' n, null, null from union double all the

    Select 'jam337', ', '1100', 'Q', to_date (January 30, 2008 "," MON-DD-YYYY'), 'P', null, null, ' n, null, null from the double

    )

    Select ftvorgn_orgn_code,

    ftvorgn_data_entry_ind,

    ftvorgn_title,

    ftvorgn_status_ind,

    -ftvorgn_orgn_code_nsf,

    -ftvorgn_hierarchy_table_ind,

    level,

    ftvorgn_orgn_code_pred

    of ftvorgn2

    Start with ftvorgn_orgn_code in (select forusor_orgn_code

    of forusor

    where forusor_user_id_entered = 'jam337. '

    - and forusor_coas_code = '

    )

    Connect prior ftvorgn_orgn_code = ftvorgn_orgn_code_pred

    and ftvorgn_eff_date<=>

    and ftvorgn_nchg_date > sysdate

    FTVORGN_ORGN_CODE FTVORGN_DATA_ENTRY_IND FTVORGN_TITLE FTVORGN_STATUS_IND LEVEL FTVORGN_ORGN_CODE_PRED
    1006 N Provost A 1 01
    2027 N SCH of Biomed Engr, Sci health Sys A 2 1006
    2028 N SCH of Science, political Engr. Envr A 2 1006
    5275 N Administration A 2 1006
    5325 N Registration & career management A 2 1006
    5350 N Office of education A 2 1006
    5365 N Library A 2 1006

    Concerning

    Etbin

  • Reg: With the help of several tables of facts in the RPD!

    Hi all

    Can I get help with the following scenario?

    We use OBIEE 11 g.
    We have a report that uses 1 single fact table to retrieve data and it must be hell a lot of time to display the data in the report.

    My question is is there a way to show the performance of the report if divide us the data in table 1 to 2 fact tables and the report uses them 2 made tables.
    Are there other ways of finalization of the report for better performance.

    Thanks for the help in advance!

    Ajay.

    Hi Ajay,

    Follow these steps for tuning;
    1. try to adjust the SQL query generated first by the report, and then make the necessary changes. (Put index on the column that is required so that your query is scanning the index instead of the whole table)

    2. you can try to create the agg fact table and use agg navigation to improve performance. (This is to reduce the data set on which sql is triggered)

    3. you can try to create partitions on the table of FACTS in the comic book, and so held the partitions are queried according to the filters.

    4. in the last if all the foregoing does not resolve your query, you can try to divide the FACT table in two or more depending on your decision and then use fragmentation content in the MDB of the RPD layer if it will strike appropriate tables depending on whether you declare.

    Mark Correct/utile so this can help.

    Good luck
    Kashi

  • How to display the results of the database from several tables in descending order?

    I have a key word to search for images on my website that allows visitors to search for specific things. My db msysql has 15 tables and for the search function I use a UNION ALL operation to join them any visitor can find all tables at the same time. The problem is that all the results are in ascending order. How can I get the results in descending order.

    SELECT *.

    FROM table1

    Keyword WHERE AS id LIKE %s or %s

    UNION ALL

    SELECT *.

    FROM table2

    Keyword WHERE AS id LIKE %s or %s

    UNION ALL

    SELECT *.

    TABLE 3

    Keyword WHERE AS id LIKE %s or %s

    PS

    I tried this and it doesn't work:

    SELECT * FROM table1 WHERE AS %s or id AS %s ORDER BY id DESC keyword

    and I know that this is not conventional to use SELECT * with so many tables, but believe me, I have my reasons. I'm not trying to do is to wrap the whole UNION within an external SELECTION

    Once more, the order by clause can only appear at the end of the last select statement in a UNION query. You have it on all select statements.

  • granting of privileges to the schema for several tables at the same time... any script?

    Hello gurus,

    I have about 25 tables in the ABC scheme

    I want to give all privialges to the XYZ schema for all tables of 25 which is in the pattern ABC... So is there is SQL statement or a script, I can run to grant privileges to all tables.

    Something similar to these...

      SELECT 'create synonym ' || table_name || ' for ' || table_name
      FROM user_tables  {code}
     
    So i get all the table names ....then i can run as a script.... U r help is greatly appriciated gurus!!!
    
    
    Thank you!!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Administrator:

    set head off
    set pages 0
    set feed off
    spool myscript.sql
    Select 'grant select, insert, update, delete on abc.'||table_name||' to xyz;'
      from dba_tables
     where owner = 'ABC';
    
    Select 'create synonym xyz.'||table_name||' for abc.'||table_name||';'
      from dba_tables
     where owner = 'ABC';
    
    spool off;
    

    Obviously this does not all new table that will be created in the future on ABC schema...

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/02/07/aggiornare-una-tabella-con-listruzione-merge/]

  • The combination of several projects to Capture

    I'm a new user of Captivate 3, embark on my first project.

    I need to do a demonstration of software which will include multiple applications at different times on the desktop. The best way to proceed is, of course, is to record the entire desktop. However, I was worried about my ability to edit the project together that I thought. I really just want some raw images that I can move on, instead of getting the demo right the first time.

    My idea was to record each application on its own window and perform a particular function. I could then create an empty project; full screen for the reader flash in a web browser - 1014 x 713 (a non-standard size of office). I could then set the background color and add images on the start bar and a couple of icons; make it look realistic. Then I import my captured applications and position them where and when I want to.

    It works very well with full motion capture video but the standard image capture is part of the blade and if you change the slide background, you lose the image of the application. It does not record the image of the application as a separate object.

    Any ideas on how I should go about my project registration, all ensuring that I have the flexibility to make things a little more later?

    Thanks for your suggestions.

    Dominic

    Hi Dominic and welcome to the forums of Captivate!

    Your idea of capturing each application separately is a good thing. Allows you to maintain each in its own file of project, which makes things easier and improves performance in Captivate. You also avoid to try to capture the entire desktop to a weird resolution.

    If it was me, I consider it must be able to show the Windows Desktop behind each application... with the exception of a few slides where you might want to show that there are many open applications, you'll probably find you want each application in order to be as large as possible to avoid scroll or needing items appearing partially off the screen.

    If you want to really have 'small' application on a common background windows, capture each application to the desired size, but when imported in your master project, copy each context 'captured' project and paste it into your master image project. What makes 'float' and to be mobile/updated separated from the background of the mask. Do a "background" on each image, and you should be golden.

    I also recommend to do some testing before committing to 1014 x 713, especially in browsers-Internet Explorer. Mode full screen can be problematic, and you can find that something like 1000 x 650, other than full screen works better.

  • A question about the count of several lines of table in a PL/SQL block

    Hi all




    I have a problem on counting the rows from several tables in a PL/SQL block, and I would be grateful if you could kindly give me a helping hand. Here's my problem: file in Microsoft Excel (one column) I have a list of several names of tables. For each table, when the number of rows is equal to 10000 I have to call a procedure. Here's how I tried to do:
    DECLARE
         CURSOR tb_cursor IS
              WITH my_table_names AS
                   (
                        SELECT  'table1'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table2'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table3'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table4'  AS tbname  FROM  DUAL  UNION
                        .
                        .  Here I continue writing one line for each table in order
                        .  to have the table names stored in my Excel file as a table 
                           to be queried by SELECT statement
                        .
                   )
              SELECT *
              FROM my_table_names;
    BEGIN
         -- Here I verify that for each table having more than 10000 lines
         -- I call the specified procedure which is needed
         
         FOR I IN tb_cursor LOOP
              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
                        
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
                   
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
         END LOOP;
    END;
    /
    I already checked this code with tables inividual and it works. The only problem is
    . . .
    SELECT COUNT(*) AS rowsNum
    FROM I.tbname;
    . . .
    Indeed, oracle considers "I.tbname" as an unknown table name (although he refers to by its exact name).
    SQL> @script.sql
    
                                    FROM I.tbname;
                                           *
    ERROR at line 99:
    ORA-06550: line 99, column 12:
    PL/SQL: ORA-00942: table or view does not exist
    How can I solve this problem? I mean, how to use a variable (in my example, I.tbname) as the table name in the FROM clause to query a table instead of explicitly write the name of the table?





    Thanks in advance,
    Dariyoosh

    Replace the following code:

              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
    
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
    
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
    

    By the following:

    Declare
      numberOfRows number;
    begin
      EXECUTE IMMEDIATE 'select count(*) from '||I.tbname into numberOfRows;
    
      IF (numberOfRows.rowsNum > 10000) THEN
        -- And here I will call the procedure which has to be run
      END IF;
    end;
    

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/10/crittografia-in-plsql-utilizzando-dbms_crypto/]

    Published by: Massimo Ruocchio, January 12, 2010 15:25
    Added Variable Declaration

  • Removal of several tables with only loop FORALL

    I need to remove the data from several tables with unique FORALL. It seems that FORALL does not support. Please let me know the alternatives to achieve this goal.

    DB version: 11 GR 2

    Write switchis for all instructions, one for each deletion. There is no reason why it should not work.

    Compare:

    PLSQL 101 :

    Here are some things to know about FORALL:

    Each FORALL statement can contain only a single DML statement. If your loop contains two updates and a deletion, then you will need to write three statements FORALL

  • mirror of the data in a table separated through trigger

    Oracle 11g r2.

    Table_account holds public user and professional info for registration (public username, name, address, logo)

    (this table can contain 1 million records)

    Table_skill(Technician Name), table_skill_child, table_skill_grand_child, table_skill_ext

    When the search for technical info, the sql will be executed against the Table_skill.  However, given that I also need to get the company name, address and information of logo with the technician information, there are two approaches:

    (1) join Table_account and Table_skill, table_skill_child, table_skill_grand_child, table_skill_ext

    Select the name of the technician, name, address, company logo

    Table_account Table_skill, table_skill_child, table_skill_grand_child, table_skill_ext

    where the...

    PRO: simple join

    CON: public user info is not necessary at all (this could potentially slow down the query speed?)

    (2) reflect the data, that is when the company data to the Table_account, use relaxation to copy the name of the company, save him address and logo on the Table_skill.  When looking for technicians, it will be fast, no need to exclude the public user names the table_account

    Select the name of the technician, name, address, company logo

    of Table_skill.

    table_skill_child, table_skill_grand_child, table_skill_ext

    where the...

    PRO: table_account, which contains the unwanted public modules is eliminated

    CON: deduplication of data for example, the logo in several tables

    Want to hear your opinion.

    Thank you

    Scott

    Hi, Scott.

    scottjhn wrote:

    Oracle 11g r2.

    Table_account holds public user and professional info for registration (public username, name, address, logo)

    (this table can contain 1 million records)

    Table_skill (name)

    When the research is done, the sql will be executed against the Table_skill.  However, given that I also need to get the company name, address and logo information, there are two approaches:

    (1) join Table_account and Table_skill

    Select the name of the technician, name, address, company logo

    of Table_account Table_skill

    where the...

    PRO: simple join

    CON: public user info is not necessary at all (this could potentially slow down the query speed?)

    (2) reflect the data, that is when the company data to the Table_account, use relaxation to copy the name of the company, save him address and logo on the Table_skill.  When looking for technicians, it will be fast, no need to exclude public usernames

    Select the name of the technician, name, address, company logo

    of Table_skill

    where the...

    PRO: a table involved

    CON: duplicate data, such as the logo in several tables

    Want to hear your opinion.

    Thank you

    Scott

    Another "con" is the difficulty of maintaining the data.  As you say, the performance will be better when doing a query that contains the replicated data, but DML will be slower.  Depending on how often you are DML and how many times you make queries that would benefit the denormalization, the benefit may or may not justify the costs.

    There are many problems involved with triggers, in addition to the performance.  A materialized view can be a better option, especially if you can tolerate slightly obsolete results (i.e. ' stale').

    This sort of thing is often done in Data Warehouse applications, where DML is frequent.  Search for the words "Data Warehouse", "Denormaliztion" and "Réplication" to learn more about the subject.

    Most of the time, people join in situations like yours.

Maybe you are looking for