Linking same table together syntax problem

Hi All
I've never had to link a table to itself before, but as I try and do it now I keep getting "missing keyword" error message at the point I try and assign a different name to the second instance of my table. Can anyone point out my mistake please?
Here is the SQL:
SELECT FSA_CO, FSA_NO, FSA_ADESC, FSA_MFNO, FSA_SREF, ERE_RET.ERE_BELONGS_TO, ERE_RET_1.ERE_DESC
FROM (FSA_ACC LEFT JOIN ERE_RET ON FSA_ACC.FSA_HIRE_GRP = ERE_RET.ERE_ID) LEFT JOIN ERE_RET AS ERE_RET_1
ON ERE_RET.ERE_BELONGS_TO = ERE_RET_1.ERE_ID WHERE (((FSA_ACC.FSA_CO)='01') AND ((FSA_ACC.FSA_NO)='P008'))
Many thanks in advance
Chris

Well, the regular Oracle syntax would be
SELECT fsa_co,
       fsa_no,
       fsa_adesc,
       fsa_mfno,
       fsa_sref,
       a.ere_belongs_to,
       a1.ere_desc
  FROM fsa_acc, ere_ret a, ere_ret a1
WHERE fsa_acc.fsa_hire_grp = a.ere_id
   AND a.ere_belongs_to = a1.ere_id
   AND fsa_acc.fsa_co = '01'
   AND fsa_acc.fsa_no = 'P008'I think the AS is what it's complaining about - it didn't care for it in regular syntax.

Similar Messages

  • How to link 2 table together?

    Hi All - I'm a new APEX user and would like to create 2 tables - one primary table, where you input data in and a secondary table, where any update you do to the primary table goes to.
    In the primary table - it consists of a primary key which is set to be generated. This primary key will be used to identify the entry later on for query purposes. This also have a variable (Number), which will be used later on as a foreign key to the secondary table to link the two tables together. Then couple of data fields to enter other things.
    In the secondary table - I've also created a primary key for this table, set to be generated (this is used as the same purpose)
    When I try to create a foreign key in the secondary table, using the variable (Number) from the primary table, I keep on getting an error and end up not able to finish the creation of the secondary table.
    Any clue or any documentation anyone can point me too is greatly appreciated...Many thanks in advance.
    Thanks,
    Joy

    Hi Joy,
    There is so much wrong herre that I am not sure where to start except to recommend that you go back to basics and learn about relational database design.
    Googling "relational database design", "entity relationship modelling" will turn up many references. Also, a trip to a good technical bookshop will also turn up many good books. Pick something that looks like it is aimed at beginners and which you feel you understand.
    Regards
    Andre

  • Historical and transaction data in the same tables creates perf problems

    Our Oracle based application is slow partly due to the fact that historical data are kept in the same table as transactional data. For example records about deceased patients, patients treated 5 years ago...etc, are kept in the one and only one patient table, which is needed to run the daily process of the hospital. So gradually all our major tables PATIENTS, CHARTS, NAMES, APPOINTMENTS have grown very large and since most of our SQL join all these tables at the same time, then all screens and reports run very slowly. I have introduced the idea that we should split all these tables in two: historical PATIENTS data, and CURRENT PATIENTS data...the same with all the others. A nice system would first search in the smaller transactional tables, which would run faster being smaller, and if no data found, then fallback to the historical tables. But this would require programming. From what I have read mateialized view could solve part of our problem. We could have views containing for example only one year worth of the data, and I guess any changes could be later replicated in the base table. What I dont know is what to do if we cannot find the patient in the matealized views ? Do I need to fallback to another SQL which will search in the initial base tables ? Anyway we can implement this without programming ? Tx.

    Appointment table: 207,470
    Visit table: 5,890,920
    Patient table: 2,993,129
    Chart table: 2,864,069
    Patient names table: 3,938,118
    SELECT
        APPOI_OR_VISIT,
        VISIT_SEQ,
        PAT_SEQ,
        INST_CODE,
        INST_CODE_DISPL,
        INST_DESC,
        CLINIC_CODE,
        CLINIC_CODE_DISPL,
        CLINIC_DESC,
        SPEC_CODE,
        SPEC_CODE_DISPL,
        SPEC_DESC,
        VISIT_DATE,
        VISIT_TIME,
        VISIT_TIME_ARRIVAL,
        APPTYPE_CODE,
        SESSION_DOM_MODE,
        PRESTYPE_CODE,
        PRESTYPE_DOM_TYPE,
        DIA_CODE,
        VISIT_TIME_START_RESP,
        VISIT_TIME_DISCHARGE,
        APPOI_NB_DURATION,
        VISIT_TX_REASON,
        VISIT_TX_COMMENT,
        EXTDOC_CODE,
        VISIT_PN_REFPHYS_NAME,
        PATYPE_CODE,
        PAYRESP_CODE,
        VISIT_IND_GROUP,
        VISIT_PCODE,
        VISIT_IND_COMPLETE,
        VISIT_IND_ADMISSION,
        VISIT_IND_CONFIDENTIALITY,
        VISIT_DATE_ACCIDENT,
        APPOI_SEQ,
        BILLING_CODE,
        VISIT_TX_DIAGNOSIS,
        CST_CODE_1,
        CST_CODE_2,
        CST_CODE_3,
        APPOI_DH_CRE,
        APPOI_CODE_CRE_USER,
        APPOI_DH_MOD,
        APPOI_CODE_MOD_USER,
        VISIT_CODE_CRE_USER,
        VISIT_DH_CRE,
        VISIT_UPDATED_COUNT,
        VISIT_CODE_MOD_USER,
        VISIT_DH_MOD,
        APPOI_PAYRESP_CODE,
        APPOI_DT_ACCIDENT,
        PATIENT_LAST_NAME,
        PATIENT_FIRST_NAME,
        PATIENT_CONFIDENTIALITY,
        PATIENT_CHART_EXT,
        TO_NUMBER(SUBSTR(PATIENT_CHART_EXT, 1, INSTR(PATIENT_CHART_EXT, '|')-1)) AS PATIENT_CHART_NO,
        PAT_IND_SPECIAL_RISK
    FROM
        SELECT
            'VISIT'              AS APPOI_OR_VISIT,
            VISIT.VISIT_SEQ,
            VISIT.PAT_SEQ,
            INSTITUTION.INST_CODE,
            INSTITUTION.INST_CODE_DISPL,
            INSTITUTION.INST_DESC,
            CLINIC.CLINIC_CODE,
            CLINIC.CLINIC_CODE_DISPL,
            CLINIC.CLINIC_DESC,
            SPECIALTY.SPEC_CODE,
            SPECIALTY.SPEC_CODE_DISPL,
            SPECIALTY.SPEC_DESC,
            VISIT.VISIT_DATE,
            VISIT.VISIT_TIME,
            VISIT.VISIT_TIME_ARRIVAL,
            VISIT.APPTYPE_CODE,
            VISIT.SESSION_DOM_MODE,
            VISIT.PRESTYPE_CODE,
            VISIT.PRESTYPE_DOM_TYPE,
            VISIT.DIA_CODE,
            VISIT.VISIT_TIME_START_RESP,
            VISIT.VISIT_TIME_DISCHARGE,
            VISIT.APPOI_NB_DURATION,
            VISIT.VISIT_TX_REASON,
            VISIT.VISIT_TX_COMMENT,
            VISIT.EXTDOC_CODE,
            VISIT.VISIT_PN_REFPHYS_NAME,
            VISIT.PATYPE_CODE,
            VISIT.PAYRESP_CODE,
            VISIT.VISIT_IND_GROUP,
            VISIT.VISIT_PCODE,
            VISIT.VISIT_IND_COMPLETE,
            VISIT.VISIT_IND_ADMISSION,
            VISIT.VISIT_IND_CONFIDENTIALITY,
            VISIT.VISIT_DATE_ACCIDENT,
            VISIT.APPOI_SEQ,
            VISIT.BILLING_CODE,
            VISIT.VISIT_TX_DIAGNOSIS,
            VISIT.CST_CODE_1,
            VISIT.CST_CODE_2,
            VISIT.CST_CODE_3,
            VISIT.APPOI_DH_CRE,
            VISIT.APPOI_CODE_CRE_USER,
            VISIT.APPOI_DH_MOD,
            VISIT.APPOI_CODE_MOD_USER,
            VISIT.VISIT_CODE_CRE_USER,
            VISIT.VISIT_DH_CRE,
            VISIT.VISIT_UPDATED_COUNT,
            VISIT.VISIT_CODE_MOD_USER,
            VISIT.VISIT_DH_MOD,
            NULL AS APPOI_PAYRESP_CODE,
            TO_DATE(NULL) AS APPOI_DT_ACCIDENT,
            NAME.NAM_PN_NAM AS PATIENT_LAST_NAME,
            NAME.NAM_PN_FNAM AS PATIENT_FIRST_NAME,
            CONFIDENTIALITY.CONF_DESC AS PATIENT_CONFIDENTIALITY,
            PI_SECURITY.F_GET_CHART_NUMBER_SCAN_CODE(VISIT.PAT_SEQ, 103 /*:pChartInstitutionID*/, 0) AS PATIENT_CHART_EXT,
            PATIENT.PAT_IND_SPECIAL_RISK
        FROM
                   AS_T_VISITS        VISIT,
                   CT_R_INSTITUTIONS  INSTITUTION,
                   AS_T_CLINICS       CLINIC,
                   CT_R_SPECIALITIES  SPECIALTY,
                   PI_T_NAMES         NAME,
                   PI_T_PATIENTS      PATIENT,
                   PI_R_CONF_LEVELS   CONFIDENTIALITY
        WHERE
            VISIT_DATE >= TO_DATE('2004-04-01', 'YYYY-MM-DD') /*:P_VISIT_DATE_FROM*/ AND
            VISIT_DATE <= TO_DATE('2004-04-02', 'YYYY-MM-DD') /*::P_VISIT_DATE_TO*/ AND
            CLINIC.CLINIC_CODE = VISIT.CLINIC_CODE AND
            SPECIALTY.SPEC_CODE = CLINIC.SPEC_CODE AND
            INSTITUTION.INST_CODE(+) = VISIT.INST_CODE AND
            NAME.PAT_SEQ = VISIT.PAT_SEQ AND
            NAME.NAMTYP_CODE = 1 AND
            PATIENT.PAT_SEQ = VISIT.PAT_SEQ AND
            CONFIDENTIALITY.CONF_CODE (+) = PATIENT.CONF_CODE
        UNION
        SELECT
            'APPOI'                                                                                                                                                                                                        AS APPOI_OR_VISIT,
            0                                                                                                                                                                                                                            AS VISIT_SEQ,
            NVL(APPOINTMENT_GROUP.PAT_SEQ, APPOINTMENT.PAT_SEQ) AS PAT_SEQ,
            INSTITUTION.INST_CODE,
            INSTITUTION.INST_CODE_DISPL,
            INSTITUTION.INST_DESC,
            CLINIC.CLINIC_CODE,
            CLINIC.CLINIC_CODE_DISPL,
            CLINIC.CLINIC_DESC,
            SPECIALTY.SPEC_CODE,
            SPECIALTY.SPEC_CODE_DISPL,
            SPECIALTY.SPEC_DESC,
            APPOINTMENT.SESSION_DATE                                                                                                                                                                AS VISIT_DATE,
            APPOINTMENT.APPOI_TIME                                                                                                                                                                     AS VISIT_TIME,
            ''                                                                                                                                                                                                                  AS VISIT_TIME_ARRIVAL,
            APPOINTMENT.APPTYPE_CODE,
            APPOINTMENT.SESSION_DOM_MODE,
            0                                                                                                                                                                                                                            AS PRESTYPE_CODE,
            ''                                                                                                                                                                                                                  AS PRESTYPE_DOM_TYPE,
            0                                                                                                                                                                                                                            AS DIA_CODE,
            ''                                                                                                                                                                                                                  AS VISIT_TIME_START_RESP,
            ''                                                                                                                                                                                                                  AS VISIT_TIME_DISCHARGE,
            APPOINTMENT.APPOI_NB_DURATION,
            APPOINTMENT.APPOI_TX_REASON                                                                                                                                                           AS VISIT_TX_REASON,
            APPOINTMENT.APPOI_TX_COMMENT                                                                                                                                                      AS VISIT_TX_COMMENT,
            APPOINTMENT.EXTDOC_CODE,
            APPOINTMENT.APPOI_PN_REFPHYS_NAME                                                                                                                                            AS VISIT_PN_REFPHYS_NAME,
            APPOINTMENT_TYPE.PATYPE_CODE  AS PATYPE_CODE,
            0                                                                                                                                                                                                                            AS PAYRESP_CODE,
            DECODE(APPOINTMENT_GROUP.PAT_SEQ,NULL,0,1)                                                                                                                   AS VISIT_IND_GROUP,
            ''                                                                                                                                                                                                                  AS VISIT_PCODE,
            0                                                                                                                                                                                                                            AS VISIT_IND_COMPLETE,
            0                                                                                                                                                                                                                            AS VISIT_IND_ADMISSION,
            APPOINTMENT.APPOI_IND_CONFIDENTIALITY                                                                                                                                  AS VISIT_IND_CONFIDENTIALITY,
            TO_DATE(NULL)                                                                                                                                                                                          AS VISIT_DATE_ACCIDENT,
            APPOINTMENT.APPOI_SEQ,
            0                                                                                                                                                                                                                            AS BILLING_CODE,
            ''                                                                                                                                                                                                                  AS VISIT_TX_DIAGNOSIS,
            0                                                                                                                                                                                                                            AS CST_CODE_1,
            0                                                                                                                                                                                                                            AS CST_CODE_2,
            0                                                                                                                                                                                                                            AS CST_CODE_3,
            APPOINTMENT.APPOI_DH_CRE                                                                                                                                                                AS APPOI_DH_CRE,
            APPOINTMENT.APPOI_CODE_CRE_USER                                                                                                                                                 AS APPOI_CODE_CRE_USER,
            APPOINTMENT.APPOI_DH_MOD                                                                                                                                                                AS APPOI_DH_MOD,
            APPOINTMENT.APPOI_CODE_MOD_USER                                                                                                                                                 AS APPOI_CODE_MOD_USER,
            ''                                                                                                                                                                                                                  AS VISIT_CODE_CRE_USER,
            SYSDATE                                                                                                                                                                                                             AS VISIT_DH_CRE,
            0                                                                                                                                                                                                                            AS VISIT_UPDATED_COUNT,
            ''                                                                                                                                                                                                                  AS VISIT_CODE_MOD_USER,
            SYSDATE                                                                                                                                                                                                             AS VISIT_DH_MOD,
            PAYRESP_CODE                                                                             AS APPOI_PAYRESP_CODE,
            APPOI_DT_ACCIDENT,
            NAME.NAM_PN_NAM AS PATIENT_LAST_NAME,
            NAME.NAM_PN_FNAM AS PATIENT_FIRST_NAME,
            CONFIDENTIALITY.CONF_DESC AS PATIENT_CONFIDENTIALITY,
                                        PI_SECURITY.F_GET_CHART_NUMBER_SCAN_CODE(APPOINTMENT.PAT_SEQ, 103 /*:pChartInstitutionID*/, 0) AS PATIENT_CHART_EXT,
            PATIENT.PAT_IND_SPECIAL_RISK
        FROM
                   AS_T_APPOINTMENTS       APPOINTMENT,
                   AS_R_APPOINTMENT_TYPES  APPOINTMENT_TYPE,
                   AS_T_CLINICS            CLINIC,
                   CT_R_SPECIALITIES       SPECIALTY,
                   CT_R_INSTITUTIONS       INSTITUTION,
                   AS_T_APPOINTMENT_GROUPS APPOINTMENT_GROUP,
                   PI_T_PATIENTS           PATIENT,
                   PI_R_CONF_LEVELS        CONFIDENTIALITY,
                   PI_T_NAMES              NAME,
                   AS_T_APPOINTMENT_SEQ_MAPPING  SEQMAP
        WHERE
            SESSION_DATE >= TO_DATE('2004-04-01', 'YYYY-MM-DD') /*:P_VISIT_DATE_FROM*/ AND
            SESSION_DATE <= TO_DATE('2004-04-02', 'YYYY-MM-DD') /*::P_VISIT_DATE_TO*/ AND
            APPOINTMENT.APPOI_DOM_TYPE IN('A','AR') AND
            CLINIC.CLINIC_CODE = APPOINTMENT.CLINIC_CODE AND
            SPECIALTY.SPEC_CODE = CLINIC.SPEC_CODE AND
            INSTITUTION.INST_CODE(+) = APPOINTMENT.INST_CODE AND
            APPOINTMENT_GROUP.APPOI_SEQ (+) = APPOINTMENT.APPOI_SEQ AND
            APPOINTMENT_TYPE.APPTYPE_CODE (+) = APPOINTMENT.APPTYPE_CODE AND
            NAME.PAT_SEQ = NVL(APPOINTMENT.PAT_SEQ, APPOINTMENT_GROUP.PAT_SEQ) AND
            NAME.NAMTYP_CODE = 1 AND
            PATIENT.PAT_SEQ = NVL(APPOINTMENT.PAT_SEQ, APPOINTMENT_GROUP.PAT_SEQ) AND
            CONFIDENTIALITY.CONF_CODE (+) = PATIENT.CONF_CODE AND
            SEQMAP.APPOI_SEQ (+) = APPOINTMENT.APPOI_SEQ AND
            SEQMAP.APPOI_SEQ IS NULL
    ORDER BY
         VISIT_DATE, VISIT_TIME, PATIENT_CHART_NO

  • Query that link two tables together

    I am using this query to extract  Account Payable data:
    SELECT T0.DocNum, T0.DocStatus, T0.DocDate, T0.DocDueDate, T0.CardCode, T0.CardName, T0.NumAtCard, T0.DocTotal FROM Akron.dbo.OPCH T0
    How would I also add the unique number for each individual payment from these tables?
    OVPM and VPM2.
    What field links these 2 tables together?

    Hi,
    You may check this: Incoming Payments Report
    Replace all INV with PCH and RCV with VPM
    Thanks,
    Gordon

  • Several chain steps loaing the same table

    I have several files coming from different places that my chain will use to update a table. I have set up a file arrival event for each file, so that when it arrives it is loaded into the same table. The problem is i don't know when each file will be arriving. What's the best way to setup the job chain so there aren't several loads to the same table happening at the same time?
    thanks.

    hi,
    Maybe it is possible to use dbms_lock to restrict access to the table to only one loading step at a time e.g. instead of loading the table, first get a lock, then load into it, then release the lock.
    I can't think of how to set this up cleanly using chain logic.
    -Ravi

  • How to populate data in the same table based on different links/buttons

    Hi
    I'm using jdeveloper 11.1.4. I have a use case in which i need to populate data in the same table based on click of different links.
    Can anyone please suggest how can this be achieved.
    Thanks

    I have a use case in which i need to populate data in the same table based on click of different linksDo you mean that you need to edit existing rows ?
    What format do you have the date in - table / form ?

  • Problem in Master-Details  - Inserting Records to same Table

    I have 3 column of one table in master as primary key and 3 column of same table in detail as primay key. These 6 column collection as the composite primary key. when i try to insert the records in detail table it showing me Too many objects match the primary key oracle.jbo.Key Error.
    I have done the Following things:
    In HR Schema, I have created one Transient View Object for Master and Employee View Object for Details.
    I have taken EmployeeId, FirstName and LastName columns in the Master i.e., From Transient View Object and droped it as the Form.
    And I have taken E-mail, JobId, ManagerId columns in Details i.e From and droped it as the Table.
    When I entered values in master and click CreateInsert in the details record. It showing me Too many objects match the primary key errors.
    Help me out!!! for this problem.

    Hi Kumar,
    I was not in office for couple of days. Thats you couldnt reply for your earlier post. You had mentioned how can we set the value of the import parameter.
    What i wanted to tell you is not to set the value for that Binary_flag, but that flag influences the data download in ASCII FORMAT.
    You just try this: Try attaching a file through CL_CRM_DOCUMENTS~CREATE_WITH_TABLE. Before read the contents of a file into SAP using GUI_DOWNLOAD and read it in ASCII mode. Now when you try to pass this to Ascii internal table of the method specifing the MIME type, it will attach the document to the opportunity, but the document content will be still in ASCII.
    If you try to download this file using GET_WITH_TABLE, then you can see BINARY_FILE is not set to 'X' and the content gets downloaded to Ascii internal table.
    This is my observation.
    I think when attaching documents in Opportunities by default, it reads the file in Binary mode. Because when i tried to attach a file directly in Opportunity transaction, and tried the method GET_WITH_TABLE, the BINARY_FLAG was set.
    Hope now you understood, why i was mentioning that BINARY_FLAG influences the download of content in binary and Ascii format.
    Regards,
    karthik.

  • Print parent to child link or path from the same table

    create table dummy(nodeid number, parentid number, nodename varchar2(20));
    insert into dummy values(100,-1,'homegoods');
    insert into dummy values(101,100,'kitchen');
    insert into dummy values(102,101,'skillet');
    select * from dummy gives:
    nodeid     parentid   node_name
    100         -1         HOMEGOODS
    101         100       KITCHEN
    102         101       SKILLETnote: parent id is the node id in the same table except for the top node.
    select nodeid, nodename, 'i want complete path from parent to child here' as path from dummy where nodeid = 102
    expected result
    nodeid   name     path
    102       skillet     homegoods>kitchen>skillethow can I do this ?
    thanks

    I thought it worked but I guess i am stuck in with real data . Please bear with me. I have never done hierarchical queries -
    there are more ids and fields that I have to put in the condition so here are the new create/insert sample stmnts.
    drop table dummy;
    create table dummy(hdr_id number,node_id number, config_item_id number, parent_config_item_id number,ps_node_name varchar2(20));
    insert into dummy values(35981400,     21400,     24547505,     -1,     'AT2200-10H');
    insert into dummy values(35981400,     21420,     24547506,     24547505,     'AT2200-10H-UWMOD');
    insert into dummy values(35981400,     37020,     24547564,     24547506,     'Corona Treater');
    insert into dummy values(35981400,     37021,     24547565,     24547564,     'None');
    insert into dummy values(35981400,     37024,     24547566,     24547506,     'Corona Type');
    insert into dummy values(35981400,     1877321,25766779,     24547566,     'None');
    select ps_node_name name,'path' from dummy where hdr_id = 35981400
    --I have to have hdr_id=something as a condition as there are numerous rows with different ids.
    so when I query for names in one hrd_id, I should get all names in that session, with paths linking parent to child upto current level.
    expected result :
    AT2200-10H     
    AT2200-10H-UWMOD        AT2200-10H>AT2200-10H-UWMOD
    Corona Treater        AT2200-10H>AT2200-10H-UWMOD>Corona Treater
    None                        AT2200-10H>AT2200-10H-UWMOD>Corona Treater>None
    Corona Type        AT2200-10H>AT2200-10H-UWMOD>Corona Type
    None                        AT2200-10H>AT2200-10H-UWMOD>Corona Type>None
    sorry for the confusion.
    Edited by: OAF-dev on Nov 18, 2009 4:24 PM

  • Problem with the sames tables in the same report

    Hi friends,
             I have a report with the same table twice. One with the original name (Company) and the second with alias (Company_A). This report wants to show a "tree" of companies. With code I get a Dataset    and I fill the report with it. This Dataset    have two tables the original and the alias table with one and two rows expletively. The data is correct is what we expect that the report will show but this not occurs. He only see the rows of the original table and if you get more than one row in it he try a Cartesian product and we see invalid results. Can I fill the report with the correct rows to show in the report? Is there any other possibility? To help I put an example:
    Fields of table Company as original table in the report: Company.
    Fields of table Company as alias table (Company_A) in the report: Company and OriginCompany.
    There is a relation between Company and Company_A through the field Company (original alias) and OriginCompany (alias table).
    The dataset    is like this:
    Table Company: one row --> Company1.
    Table Company_A: two rows --> Company1a, Company.
                                                   Company2a, Company.
    Then the report only shows the rows of the original table Company but no trace of the alias table Company_A
    If someone can help me thanks and if not also!!!
    Edited by: JuliaRomero on Jun 1, 2009 4:30 PM

    Use two connections not one when you are embedding one result set in another.
    If you are embedding one in the other also consider using a join which is faster and requires less code.

  • Sinlge select query in diff schemas for same table(Indentical Structure)

    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.
    Creating an view is an option.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.
    So is there any option that would allow me to use single query on different schema's ?

    Hi,
    970773 wrote:
    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.That depends on what you mean by "effective".
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.You can do a UNION, so the data from the two years appears together. The number of actual tables may make the query slower, but it won;t change the results.
    Given that you have 2 tables, the fact that they are in different schemas doesn't matter. Just make sure the user running the query has SELECT privileges on both of them.
    Creating an view is an option.Is it? You seem to say it is not, below.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.So creating a view is not an option. Or is it?
    So is there any option that would allow me to use single query on different schema's ?Anything that you can do with a view, you can do with sub-queries. A view is merely a convenience; it just saves a sub-query, so you don't have to re-code it every time you use it. Assuming you have privilges to query the base tables, you can always avoid using a view by repeating the query that defines the view in your own query. It will not be any slower

  • Error insert data over db link in table covered by materialized view

    Hello together,
    following problem:
    I got a table called LOCATION_INFO which is defined:
    create table LOCATION_INFO
    LOCATION_ID VARCHAR2(40) not null,
    PLANT VARCHAR2(4) not null,
    PRODUCT VARCHAR2(3),
    AREA VARCHAR2(1),
    LINE NUMBER(10),
    STATION NUMBER(10),
    STATINDEX NUMBER(10),
    FU NUMBER(10),
    WP NUMBER(10),
    TP NUMBER(10),
    LOCATION_LEVEL NUMBER(1) not null,
    LOCATION_PARENT_ID VARCHAR2(40),
    TIME_STAMP TIMESTAMP(6) WITH TIME ZONE not null
    I try to load data over PL/SQL procedure from another database using database link:
    INSERT INTO LOCATION_INFO
    (LOCATION_ID,
    PLANT,
    PRODUCT,
    AREA,
    LINE,
    STATION,
    STATINDEX,
    FU,
    WP,
    TP,
    LOCATION_LEVEL,
    LOCATION_PARENT_ID,
    TIME_STAMP)
    SELECT LOCATION_ID,
    PLANT,
    PRODUCT,
    AREA,
    LINE,
    STATION,
    STATINDEX,
    FU,
    WP,
    TP,
    LOCATION_LEVEL,
    LOCATION_PARENT_ID,
    GetUTCDateTime(TIME_STAMP) AS time_Stamp
    FROM LOCATION_INFO@SOURCE_MMPDDB
    WHERE ROWNUM < 100;
    This works fine (If i do select count(*) from location_info the data is present) but if set a commit
    ORA-00603 appears and the session is terminated.
    The point is i got a materialized view MVIEW_LOCATIONS in another schema in the database reading the data from my table location_info and a corresponding MVIEWLOG.
    create table MLOG$_LOCATION_INFO
    LOCATION_ID VARCHAR2(40),
    SNAPTIME$$ DATE,
    DMLTYPE$$ VARCHAR2(1),
    OLD_NEW$$ VARCHAR2(1),
    CHANGE_VECTOR$$ RAW(255)
    CREATE MATERIALIZED VIEW MVIEW_LOCATIONS
    REFRESH FAST ON COMMIT
    ENABLE QUERY REWRITE
    AS
    SELECT "LOCATION_INFO"."LOCATION_ID" "LOCATION_ID","LOCATION_INFO"."PLANT" "PLANT","LOCATION_INFO"."PRODUCT" "PRODUCT","LOCATION_INFO"."AREA" "AREA","LOCATION_INFO"."LINE" "LINE","LOCATION_INFO"."STATION" "STATION","LOCATION_INFO"."STATINDEX" "STATINDEX","LOCATION_INFO"."FU" "FU","LOCATION_INFO"."WP" "WP","LOCATION_INFO"."TP" "TP","LOCATION_INFO"."LOCATION_LEVEL" "LOCATION_LEVEL","LOCATION_INFO"."LOCATION_PARENT_ID" "LOCATION_PARENT_ID","LOCATION_INFO"."TIME_STAMP" "TIME_STAMP" FROM "CP4MMPDNEW"."LOCATION_INFO" "LOCATION_INFO";
    What do I need to do to make the insert working properly without deleting my mviews?
    Can anyone help me?
    Thanks, Matthias

    Helllo,
    Can you change this on your Materialized View DDL:
    REFRESH FAST ON COMMITTo:
    REFRESH FAST ON DEMANDThen, if your INSERT and COMMIT works OK then, can you try:
    exec DBMS_MVIEW.REFRESH('MVIEW_LOCATIONS')

  • Sinlge select query in different schemas for same table(Indentical Structu)

    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.

    Thanks for the reply
    Creating an view is an option.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.
    So is there any option that would allow me to use single query on different schema's ?

  • Linking text boxes together?

    hello,
    I work with a book (.indb) with many different Documetns linked in it(.indd)
    Problem is that i have a lot of textboxes that are the same in the documents and also across the documents.
    What i would like to do is to link them all together somehow and either have
    -one master (if i make changes in that it applies to all of them)
    or
    -everyone as a master, i make changes anywhere and all of them get changed
    best would be though
    -i have one master wich changes all of them but i can have extra text in the individual textboxes if needed. (I could solve this by just doing extra textbox n the pages i need some extra text)
    Also dont know if it matters but the text in the textbox is conditional text (shouldnt make a difference  think)
    So what i want to know is if you can do this and if so, how you do it.
    Thank you in advance
    /Simon

    SimonSchneider wrote:
    Thank you for the quick reply,
    So there is no way of linking text boxes together?
    Becouse i only have a small amount of text that has to be the same on certain pages.
    So i cant put it inot master page and i dont really want to place an entire page,
    I hope I understood the procedure correctly.
    Thank you in advance
    Consider cross-references. Each cross-reference brings in a whole paragraph, to another place in the same document, or from a separate document. The source content can be in a separate document that's one of those in an InDesign book, or one that's not in a book. Cross-reference source content and the source that's captured can both be conditionalized, though, hiding the source creates unresolved references.
    Changing the source content changes all instances that capture it.
    Search Google for terms like "InDesign cross-reference tutorial" without quotes for details.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices    

  • Update Rows with info from other Rows in Same Table.

    I'm trying to update rows with information from the same table. The table gets loaded with info from a report that runs and it has to be a new entry every month but I would like to carry over some of the info from last month. This statement below runs but updates all rows in the new table load and in my test cases I only made a few match so only like 5 records should get updated. This is an example of what I'm trying to do. If I add this(C2.COL_INVC_ID = C1.COL_INVC_ID) to the last "*Where*" statement I get an invalid identifier for "C2.COL_INVC_ID". So what am I doing wrong here??? How can I update only the rows that where also in last months run???
    Thanks in advance for any help!
    Update OpenIssues OI1
    Set(OI1.Num, OI1.Status, OI1.Code, OI1.LastModifiedDate) =
    (Select OI2.Num, OI2.Status, OI2.Code, OI2.LastModifiedDate
    From OpenIssues OI2
    Where OI2.num = OI1.num and OI2.TableLoadDate = TO_DATE('01/31/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    Where and OI1.TableLoadDate = TO_DATE('02/29/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    SQLMe

    Hi,
    Welcome to the forum!
    SQLMe wrote:
    I'm trying to update rows with information from the same table. The table gets loaded with info from a report that runs and it has to be a new entry every month but I would like to carry over some of the info from last month. This statement below runs but updates all rows in the new table load and in my test cases I only made a few match so only like 5 records should get updated. This is an example of what I'm trying to do. If I add this(C2.COL_INVC_ID = C1.COL_INVC_ID) to the last "*Where*" statement I get an invalid identifier for "C2.COL_INVC_ID". If the aliases c1 and c2 aren't defined anywhere, then you can't use them anywhere.
    The WHERE clause of the UPDATE statement can only reference the table being updated, ot1 in this case.
    So what am I doing wrong here??? How can I update only the rows that where also in last months run???
    Thanks in advance for any help!
    Update OpenIssues OI1
    Set(OI1.Num, OI1.Status, OI1.Code, OI1.LastModifiedDate) =
    (Select OI2.Num, OI2.Status, OI2.Code, OI2.LastModifiedDate
    From OpenIssues OI2
    Where OI2.num = OI1.num and OI2.TableLoadDate = TO_DATE('01/31/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    Where and OI1.TableLoadDate = TO_DATE('02/29/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
    ------------There's a syntax error in the last line. Either something got lost when you posted the code, or you just don't want the keyword AND. You certainly don't want AND immediately after WHERE.
    In general, if it's not obvious how to do an UPDATE, then UPDATE is the wrong tool: you want MERGE instead.
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Simplify the problem as much as possible. Remove all tables and columns that play no role in this problem.
    If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
    Always say which version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • Linking 2 tables

    Hello,
    I have a Sheet with 2 different Tables, one on Top of each other.
    Each of these 2 Tables have data that have been extracted from other sheets according to various criterias that vary.
    I want to print these 2 Tables, with not much gap in between.
    My problem is that, depending on the amount of data being extracted and poured into these 2 Tables, the size (number of Rows) varies quite a bit and it happens that one Table ends up being on top of the other, and therefore not showing when I print.
    Is there a way to 'Link' those 2 Tables, so that, when I print, the bottom (last row) of the 1st Table is just above the top (1st row) of the second Table, whatever the number of rows is in each Tables??
    Any help appreciated,
    Thank you
    Eric

    Here's what I did as a test:
    In a new document I created a new sheet with two tables. Column B of both tables pull data from Sheet 1::Table 1:: B. I put a filter on both tables so that only rows with data in column B would show. I put them end to end so the bottom row of the top table touches the top row of the bottom table. So they look like one table. I then put data in Sheet 1:Table 1:B. Both of my other tables expanded, showing the rows with data. The bottom table moved down; it was never covered up by the top table. I tried the same test with the tables not touching and, again, the bottom table moved down. I swapped the two tables, still no problem. I locked the two tables, then had a problem.
    From all that, I ask the question: Are your tables locked?

Maybe you are looking for