Multi-Schema Query

Hello,
Please forgive me if this is an elementary question...I'm trying to run a query against multiple schema's but it does not work. I've Associated both schema's with my workspace and I tried running it in the SQL Workshop and it runs fine there. When I create a report page and specify the query there it tells me that table/view does not exist. I also tried building it using the query builder utility, the second schema name does not appear on the drop down list at the top right of the page.
Can anyone help out with this?
Thanks!!!

Hello:
Generally, if a query runs from SQL Workshop you should be able to use the query in an APEX report.
Check if making an explicit grant on the table in the other schema to the default schema of your application makes a difference.
Example: If SchemaA and SchemaB are the two schemas allowed for your workspace and if TableA exists in SchemaA and TableB exists in SchemaB
Grant select on SchemaA.TableA to SchemaB
Grant select on SchemaB.TableB to SchemaAVarad

Similar Messages

  • SQL+-MULTI TABLE QUERY PROBLEM

    HAI ALL,
    ANY SUGGESTION PLEASE?
    SUB: SQL+-MULTI TABLE QUERY PROBLEM
    SQL+ QUERY GIVEN:
    SELECT PATIENT_NUM, PATIENT_NAME, HMTLY_TEST_NAME, HMTLY_RBC_VALUE,
    HMTLY_RBC_NORMAL_VALUE, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE,
    DLC_POLYMORPHS_NORMAL_VALUE FROM PATIENTS_MASTER1, HAEMATOLOGY1,
    DIFFERENTIAL_LEUCOCYTE_COUNT1
    WHERE PATIENT_NUM = HMTLY_PATIENT_NUM AND PATIENT_NUM = DLC_PATIENT_NUM AND PATIENT_NUM
    = &PATIENT_NUM;
    RESULT GOT:
    &PATIENT_NUM =1
    no rows selected
    &PATIENT_NUM=2
    no rows selected
    &PATIENT_NUM=3
    PATIENT_NUM 3
    PATIENT_NAME KKKK
    HMTLY_TEST_NAME HAEMATOLOGY
    HMTLY_RBC_VALUE 4
    HMTLY_RBC_NORMAL 4.6-6.0
    DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE     60
    DLC_POLYMORPHS_NORMAL_VALUE     40-65
    ACTUAL WILL BE:
    &PATIENT_NUM=1
    PATIENT_NUM 1
    PATIENT_NAME BBBB
    HMTLY_TEST_NAME HAEMATOLOGY
    HMTLY_RBC_VALUE 5
    HMTLY_RBC_NORMAL 4.6-6.0
    &PATIENT_NUM=2
    PATIENT_NUM 2
    PATIENT_NAME GGGG
    DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE     42
    DLC_POLYMORPHS_NORMAL_VALUE     40-65
    &PATIENT_NUM=3
    PATIENT_NUM 3
    PATIENT_NAME KKKK
    HMTLY_TEST_NAME HAEMATOLOGY
    HMTLY_RBC_VALUE 4
    HMTLY_RBC_NORMAL 4.6-6.0
    DLC_TEST_NAME DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE     60
    DLC_POLYMORPHS_NORMAL_VALUE     40-65
    4 TABLES FOR CLINICAL LAB FOR INPUT DATA AND GET REPORT ONLY FOR TESTS MADE FOR PARTICULAR
    PATIENT.
    TABLE1:PATIENTS_MASTER1
    COLUMNS:PATIENT_NUM, PATIENT_NAME,
    VALUES:
    PATIENT_NUM
    1
    2
    3
    4
    PATIENT_NAME
    BBBB
    GGGG
    KKKK
    PPPP
    TABLE2:TESTS_MASTER1
    COLUMNS:TEST_NUM, TEST_NAME
    VALUES:
    TEST_NUM
    1
    2
    TEST_NAME
    HAEMATOLOGY
    DIFFERENTIAL LEUCOCYTE COUNT
    TABLE3:HAEMATOLOGY1
    COLUMNS:
    HMTLY_NUM,HMTLY_PATIENT_NUM,HMTLY_TEST_NAME,HMTLY_RBC_VALUE,HMTLY_RBC_NORMAL_VALUE     
    VALUES:
    HMTLY_NUM
    1
    2
    HMTLY_PATIENT_NUM
    1
    3
    MTLY_TEST_NAME
    HAEMATOLOGY
    HAEMATOLOGY
    HMTLY_RBC_VALUE
    5
    4
    HMTLY_RBC_NORMAL_VALUE
    4.6-6.0
    4.6-6.0
    TABLE4:DIFFERENTIAL_LEUCOCYTE_COUNT1
    COLUMNS:DLC_NUM,DLC_PATIENT_NUM,DLC_TEST_NAME,DLC_POLYMORPHS_VALUE,DLC_POLYMORPHS_
    NORMAL_VALUE,
    VALUES:
    DLC_NUM
    1
    2
    DLC_PATIENT_NUM
    2
    3
    DLC_TEST_NAME
    DIFFERENTIAL LEUCOCYTE COUNT
    DIFFERENTIAL LEUCOCYTE COUNT
    DLC_POLYMORPHS_VALUE
    42
    60
    DLC_POLYMORPHS_NORMAL_VALUE
    40-65
    40-65
    THANKS
    RCS
    E-MAIL:[email protected]
    --------

    I think you want an OUTER JOIN
    SELECT PATIENT_NUM, PATIENT_NAME, HMTLY_TEST_NAME, HMTLY_RBC_VALUE,
    HMTLY_RBC_NORMAL_VALUE, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE,
    DLC_POLYMORPHS_NORMAL_VALUE
    FROM PATIENTS_MASTER1, HAEMATOLOGY1,  DIFFERENTIAL_LEUCOCYTE_COUNT1
    WHERE PATIENT_NUM = HMTLY_PATIENT_NUM (+)
    AND PATIENT_NUM = DLC_PATIENT_NUM (+)
    AND PATIENT_NUM = &PATIENT_NUM;Edited by: shoblock on Nov 5, 2008 12:17 PM
    outer join marks became stupid emoticons or something. attempting to fix

  • Multi Schema to single schema.

    Hi,
    I am new to streams.
    Can it be possible to push the changes from multi schemas to a single schema? Structure for the consolidated schema will be same as other source schemas. Juast an additional column in target tables. I would like populate a unique id for each schema.
    Any example is much appreciated.
    Thanks.

    It is possible. But you have to change the schema name in the changes by using a dml-handler or a transformation rule. For a dml handler I have an example:
    CREATE OR REPLACE PROCEDURE emp_dml_handler(in_any IN SYS.AnyData) IS
    lcr SYS.LCR$_ROW_RECORD;
    rc PLS_INTEGER;
    command VARCHAR2(10);
    old_values SYS.LCR$_ROW_LIST;
    BEGIN
    -- Access the LCR
    rc := in_any.GETOBJECT(lcr);
    -- Get the object command type
    command := lcr.GET_COMMAND_TYPE();
    -- Check for DELETE command on the employees table
    IF command = 'DELETE33' THEN
    -- Set the command_type in the row LCR to INSERT
    lcr.SET_COMMAND_TYPE('INSERT');
    -- Set the object_name in the row LCR to EMP_DEL
    lcr.SET_OBJECT_NAME('DESTINATION.EMPLOYEES');
    -- Get the old values in the row LCR
    old_values := lcr.GET_VALUES('old');
    -- Set the old values in the row LCR to the new values in the row LCR
    lcr.SET_VALUES('new', old_values);
    -- Set the old values in the row LCR to NULL
    lcr.SET_VALUES('old', NULL);
    -- Add a SYSDATE value for the timestamp column
    -- lcr.ADD_COLUMN('new', 'TIMESTAMP', SYS.AnyData.ConvertDate(SYSDATE));
    -- Apply the row LCR as an INSERT into the emp_del table
    lcr.EXECUTE(true);
    END IF;
    END;
    BEGIN
    DBMS_APPLY_ADM.SET_DML_HANDLER(
    object_name => 'source.employees',
    object_type => 'TABLE',
    operation_name => 'INSERT',
    error_handler => false,
    user_procedure => 'strm_emp_admin.emp_dml_handler',
    apply_database_link => NULL,
    apply_name => NULL);
    END;
    Regards,
    Martien

  • Can PQO been used in DML statements to speed up multi-dimension query ?

    We have
    limit dim1 to var1 ne na
    where dim1 is a dimension.
    var1 is a variable dimensioned by dim1.
    This is pretty much like SQL table scan to find the records. Is there a PQO (parallel query option)-like option in DML to speed up multi-dimension query ?

    This is one of the beauties of the OLAP Option, all the query optimisation is managed by the engine itself. It resolves the best way to get you the result set. If you have partitioned your cube the query engine will perform the same way as the relational query engine and employ partition elimination.
    Where things can slow down is where you used compression, since to answer a question such as "is this cell NA?" all rows in the cube need to be uncompressed before the query can be answered and result set generated. Compression technology works best (i.e. is least intrusive in terms of affecting query performance) where you have a very fast CPU. However, the overall benefits of compression (smaller cubes) nearly always outweigh the impact of having to uncompress data to answer a specific question. Usually the impact is minimal if you partition your cube, since the un-compress function only needs to work on a specific partition.
    In summary, the answer to your question is "No", because the OLAP engine automatically optimises the allocation of resources to return the result-set as fast as possible.
    Is there a specific problem you are experiencing with this query?
    Keith Laker
    Oracle EMEA Consulting
    OLAP Blog: http://oracleOLAP.blogspot.com/
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    DM Blog: http://oracledmt.blogspot.com/
    OWB Blog : http://blogs.oracle.com/warehousebuilder/
    OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • Multi schema versus single schema set up

    Hi,
    I have a question regarding the environment set up of an Oracle datawarehouse regarding multischema versus single schema set up. My database has several schemas on it representing the functional areas of the warehouse. I have installed the Runtime Repository on the Database and registered each target schema with it. Now that I have started developing, I have noticed the way in which OWB builds database links for mappings which have source and target objects residing in different schemas. I therefore have a major concern regarding the performance of such a set up as opposed to one with a single schema. If anyone has had any experience of working with both environments please could they advise me.
    Your comments will be most appropriate.
    Take care
    Mitesh

    The requirement of sigle or multi schema is driven by the business requirement and it is a policy descion than a techical one.
    Depending upon requirement you can have not only multiple schemas but also multiple instances or databses or server for OLTP , Staging and Star
    Normally for good performance staging and star (which means one for each layer) a schema is created as it offers good performance over single schema set up.

  • Multi-fact Query

    Hi all,
    Our software group is looking at creating a tool that will query multi-fact star schema environment. What are my options?
    So far, we have 7 fact tables and 6 dimensions (all shared by the facts). There are no aggregate tables.
    My first thought was one large aggregate table, however the dimensions are all normalized to their particular fact table. So, a customer dimension (for instance) would repeat customers if they fall into multiple fact tables. The dimensions are more complicated than that, but you get the idea. There are only two that are truly normalized...and yes one is TIME. :)

    If you have data that shares all the same dimensions, it almost always makes sense to keep it together in a single fact table. The general guideline is only to split out a new fact table if the dimensionality of the data is different.
    Unions and joins typically just end up slowing things down.
    The only exception I've really seen to this rule is when one set of facts has orders of magnitude more data points then the others. I.e. if you have actuals data that has 100 million rows, but budget data (with the same dimensionality) with only 200,000 rows. This doesn't happen often, but I suppose it could potentially occur.
    Scott

  • Database with many schemas - query schema depending on user

    Let's assume we have a number of schemas in a database (hundred or so), which all contain the same tables.
    The customer wants one application express application which accesses only the schema corresponding to the user that is currently logged in.
    So database schema user1 contains table EMP, and schema user2 also contains EMP. Now the application is assigned both schemas user1 and user2, and when user2 logs in he only sees database schema user2.
    Is this possible with Apex? I've tried both built-in authentication and database authentication for the application, but found out this is truly only about authentication, because the query is always executed by APEX_PUBLIC_USER.
    How can I manage which schema is accessed with the authenticated user?
    Thanks in advance!

    Patrick,
    Every apex application has an "owner" attribute which is used as the parsing schema. All SQL and PL/SQL in your app is parsed as that schema using that schema's privileges. It is as if your application were a definer's rights stored procedure in that schema. The APEX_PUBLIC_USER schema is simply used to create the session and has no bearing on privileges. Currently there is no way to change the owner attribute of an application at runtime. However, your application can operate with any schema in the database according to the privileges granted to the parsing schema. Something along the lines of what you described was discussed at length in the following thread, maybe it will give you some ideas to try out: Access to owner schema throught APIs
    Scott

  • Need a table schema query

    First of all, sorry if this is covered in another thread... the topic is very hard to search for... "table field query"? lol
    I need to make a query of Oracle system tables to report on the schema of a particular table; i.e.:
    Fieldname, datatype, length, nullable, PK?, FK?
    I can do this in SQL Server by querying system tables. In Oracle I need it even more because all the tools I have tried (SQL Developer, TOAD, PLSQL Developer) don't let you save or print table schemas for some reason. The best I can do is script out DDL and edit out all the goop and format everything to a report. That takes forever.
    Thanks in advance for any tips...

    This is a sample query to get table details and its PK:
    select a.table_name, a.column_name, a.DATA_TYPE, a.DATA_LENGTH,
           a.NULLABLE, b.constraint_name, b.position, c.constraint_type
       from all_tab_columns a,
              all_cons_columns b,
              all_constraints c
      where a.table_name      = 'TABLE_NAME'
        and a.table_name      = b.table_name (+)
        and b.constraint_name = c.constraint_name (+)
        and a.column_name     = b.column_name (+)
        and (c.constraint_type IS NULL or c.constraint_type = 'P');

  • Multi-layers query

    According to the definition of the layer given in Oracle Spatial documentation every layer is locating in its own table. I have a scheme there multiple layers share same coordinate system and exist some coordinate systems. For each coordinate system i have to define own table with geometries. It is clear. The question is why i have to separate multiple layers ti different tables and cannot keep all geometry primitives in on table no matter to which layer they belong ? I can add some kind of identification for layer id and do query according to the layer id first and then by RELATE function (for instance) ...
    Index can be defined for this layer id that will speed up query.
    From other side managment of multiple tables demands dynamic SQL scripts a lot of check ups etc.
    What is conventional way to design such a system ?
    I need an answer ASAP
    Thank you
    null

    I don't know anything about the requirements
    of your application.
    But, do you display 200 layers on
    your map at the same time?
    It seems like there would be too much data displayed to be meaningful to a user.
    If for example you are drawing 10 of the
    200 layers, it will probably be more efficient to query the 10 layers (each in their own table), than to query a single table with all 200 layers and sift out
    the 10 layers you are interested in by some
    attribute ID.
    The spatial index would not have to
    sift through the index records for the
    190 layers you are not interested in.
    Hope this helps. Thanks.
    Dan

  • VPD vs Multi Schema vs Partitioning

    Hi Oracle Gurus,
    We will develope a web based ERP application for a company with multi branch (about 20), with the following requirement :
    - a normal user can only see and update data for his branch
    - some users from head quarters can see ALL data from ALL branch
    - reporting will be per branch, but there should be Consolidation reports
    Total user will be 200, but maximum concurrent is 60 users.
    We will use JSF(ADF Faces) + BC4J, one database server and one apps server.
    The question is :
    To meet the requirement above about which user can see which data, what Oracle feature should I use :
    is it VPD ?
    or should I just use different schema for each branch ?
    or use Partitioning ?
    Thank you for your recommendation,
    xtanto

    Xtanto
    1) Using partitioning won't in itself help with the security question.
    - It may help with performance (or it may well not).
    2) A different schema for each branch
    - is simple and scalable for branch applications,
    - but is a total pain in the neck for consolidation (you will create lots of reporting UNION ALL views)
    - and it makes it harder to deal with session pooling in the Java application tier if that ever becomes necessary (because you need a separate session pool for each branch, and one for the head office).
    - and it works the database harder (every distinct SQL statement in the SGA is multiplied by the number of branches
    - and it makes datamodel maintenance 20 times more tedious
    - and you have to decide which data is 'shared' (eg employees? cost codes? customers?) and which are owned by the branch. Some data may be visible to everyone, but 'owned' by a particular branch (or equally likely, by a particular function like HR, Buying, whatever)
    3) I have no personal experience of VPD itself. But I'd go for VPD or failing that for old-fashioned 'roll your own' application security (which is often implemented more or less the same as VPD, but at a higher cost to the developer). This gives you the most flexibility; it makes it possible for different users to have overlapping views of the data (eg if you add a regional structure between branches and head office, they may need to see several but not all branches).
    Because you have a small app (only 60 users, only 20 branches) some of the downsides of using separate schemas are not such a big thing - but even at 20 branches, the union views will get very unwieldy... And for sure, all organisations change shape over time - don't assume that today's structure will still be in place in 12 months time!
    My 2d, HTH
    Regards Nigel

  • Transferring multi-column query result into MS Excel

    Hello everybody!
    An ultimate novice in Oracle, with some database concepts, is here.
    The very first challenge; which I encoutered is that I want to transfer a Select query result, with multiple columns, into MS Excel sheet in a way that each field occupies a separate column in the sheet.
    I hope the forum members will show me a simple way to get around the problem.
    Thanks in anticipation.
    Rabi

    what will happen the query returns too many rows that
    Excel cant hold? I faced this problem and divided the
    report into "n" numbers based on the number of rows
    returned. Is there any internal logic for it in
    oracle?Excel is capable of holding 65536 rows of data on a sheet.
    Oracle is capable of writing data out to files.
    Oracle does not know or care whether the file it is writing is for Excel or any other product, as the file you are likely to be writing is CSV (comma seperate format) which is an open format, not specifically for Excel. If you need to limit the number of rows per CSV file then you will have to code this "business logic" into your code that produces the CSV file from Oracle.

  • Multi Provider Query Problem

    Hi Friends,
    I was created a new multiprovider which contains two InfoCubes, First infocube contains the Site & Material and second infocube contains only Material, so when i executed the query it is Showing the first cube Values in some rows, after ending the first query values, it is showing the second query values, i am unable to finding the solution.
    Plz help me.
    Regards,
    Rams.
    Message was edited by:
            Rams Rams

    Hi,
    Check in the multiprovider option if you have selected the material number to match with both infoproviders, in order to do this :
    1)Double click in MultiProvider
    2)Next
    3)Characteristic Tab, click in Identification Button.
    4)Check if the material number is selected in both infoprovider
    End
    Regards
    Asign point if useful

  • Button/multi state query

    Hello all
    I’m encountering a challenge which I believe has been discussed on these forums.
    This relates to pixelated, blurry text within buttons and multi-state objects.
    One solution to this issue is not using the objects containing text as buttons or multi-state objects. Instead, you insert shapes with no fill/stroke on top of text graphics and then grouping them.
    This ensures the text is sharp and clear.
    However, if you wish to have a roll over state, with a different fill/stroke/text colour as part of the roll-over state, then this poses problems as the shape serving as a button has to have no fill/stroke or text within them.
    Has around a work around for this problem?
    Many thanks
    H

    For clear buttons with click states, the easiest workaround is to place a dummy button over the image and change the stroke and perhaps even add a transparency fill. There is another more complicated workaround as well. For examples and instructions, see DPS Tips > Advanced Overlays > Sharp Buttons.
    http://contentviewer.adobe.com/s/DPS%20Tips/7f80a0ffed3a4ff08734bc905aac4a29/Advanced_Over lays/12_button_crisp.html

  • Run a SQL procedure with multi database querying from Excel

    I'm using SQL Server 2008 Enterprise. I created a procedure in one database. The procedure is composed of several queries to different databases and the final combined result set is being displayed.
    I try to execute it via Excel, so the results will appear automatically in Excel sheet, but I'm getting the error:
    "The query did not run, or the database table could not be opened. Check the database server or contact your DBA. Make sure the external
    database is available and hasn't been moved or recognized, then try the operation again".
    I created a simpler procedure that queries only one database, and the results displayed at the Excel sheet with no issues.
    I suspect that, the original procedure failed due to the fact that I'm querying several databases in the procedure, when in the connection details of the "External Data Properties", only one database is mentioned.
    My question is - can it be solved? Can I use multiple databases in the procedure and see it in the Excel?
    Thanks, Roni

    Use Global Temporary table(##) instead of Local Temporary table(#).
    The scope of the temp table is limited to one database and it dispose automatically when jump to another database.
    No, that is not correct. From where did you get that idea?
    USE tempdb
    go
    CREATE TABLE #a(a int NOT NULL)
    INSERT #a(a) VALUES(9)
    go
    USE master
    go
    SELECT a FROM #a
    go
    USE msdb
    go
    SELECT a FROM #a
    go
    DROP TABLE #a
    And Roni's stored procedure does not even change database.
    ...however, the temp tables may very well be the problem, but for a completely different reason. Excel may ask SQL Server for the shape of the result set before it runs the procedeure, and this does not work with the temp tables. For this reason, using a
    table variable my save the show.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Basic schema query

    I want to list all users, who has created at least one object in his schema(table proc trigger etc..).
    I want to exlude any user which exists and might have privileges on other users objects but has not created or owns any objects.
    ALL_OBJECTS is this the right view or any other suggestion...
    thanks
    Edited by: user11356487 on Mar 14, 2011 12:17 PM

    user11356487 wrote:
    I want to list all users, who has created at least one object in his schema(table proc trigger etc..).
    select owner, count(1) from dba_objects
    group by owner
    having count(1)>0
    I want to exlude any user which exists and might have privileges on other users objects but has not created or owns any objects.
    ALL_OBJECTS is this the right view or any other suggestion...
    And what have you done for the second task?
    thanks
    Edited by: user11356487 on Mar 14, 2011 12:17 PM

Maybe you are looking for

  • Receiver SOAP Communication Channel  Error

    Hi, I am trying to post a file to a WebService but facing the below error in the communication channel : Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/PARSING/ADAPT

  • Event handlers:  click in mxml tags or in AS?

    Is there an advantage to putting click event handlers in AS rather than in the mxml tags?  For example in AS button_1.addEventListenter(MouseEvent.CLICK, someFunctionName); or in mxml tags <s:Button click="someHandlerName(event) /> Thanks

  • Programaticlly change reference of display template for a CSWP

    I have created a custom display template for one of my CSWP. Now, How can I change the CSWP property - Item and Control Template, programmatically. - GEM

  • Case structure not going through all cases before restarting

    I have a case structure and it is not going throught the entire list of cases, I cannot figure out the problem. Any help would be greatly appreciated. I have attached my VI: Attachments: 42sampleWorkingCodeNI.vi ‏974 KB

  • Unable to use Adobe Reader on some PDFs -- Please Help

    Hi.  I have a new HP laptop.  It uses Windows 7.  I have Adobe Reader -- I had 9.0 and was having problems so took it back to the store and they have now loaded 9.3.  It is hit or miss on opening some pdfs.  The only error message I get is that "ther