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

Similar Messages

  • Basic SQL query scripts for SAP B1

    hi guys,
    do you have any documents, guides or reference links regarding basic SQL query scripts for SAP B1?
    thanks and have a nice day!
    blake p.

    Hi
    You can also check SBONotes.com.
    For sql understanding , you can search in websearch - tsql and it will pop up with informations you need.
    You can also refer to forum once you understand the basic techniques
    Hope this helps
    Bishal

  • Can someone quickly spot the syntax error in this basic XML query?

    I'm very new to SQL/XML and I'm using this query in the basic HR schema provided by Oracle in the 10g Express Edition Database.
    I'm getting the "ORA-00907: missing right parenthesis" message when I run the following query, but the parenthesis all seem to match up:
    SELECT
    XMLELEMENT ("EMPLOYEES",
    XMLAGG(XMLELEMENT ("DEPARTMENTS",
    XMLELEMENT ("Department", department_name),
    (SELECT
    XMLELEMENT ("EMPLOYEE",
    XMLAGG(XMLELEMENT ("Empno", employee_id),
    XMLELEMENT ("Job", job_id),
    XMLELEMENT ("FirstName", first_name),
    XMLELEMENT ("LastName", last_name),
    XMLELEMENT ("Email", email),
    XMLELEMENT ("Phone", phone_number)))
    AS result
    FROM employees
    WHERE employees.department_id = departments.department_id)))
    AS result
    FROM departments)

    You do have the correct number of parenthesis, just the last one is in the wrong spot. Here is the corrected version. I moved the trailing ) to before "AS result"
    SELECT
    XMLELEMENT ("EMPLOYEES",
      XMLAGG(
        XMLELEMENT ("DEPARTMENTS",
          XMLELEMENT ("Department", department_name),
          (SELECT
             XMLELEMENT ("EMPLOYEE",
               XMLAGG(
                 XMLELEMENT ("Empno", employee_id),
                 XMLELEMENT ("Job", job_id),
                 XMLELEMENT ("FirstName", first_name),
                 XMLELEMENT ("LastName", last_name),
                 XMLELEMENT ("Email", email),
                 XMLELEMENT ("Phone", phone_number)
             ) AS result
             FROM employees
            WHERE employees.department_id = departments.department_id
    AS result
    FROM departmentsI don't have those tables installed but when I made a few tweaks and tried to run the above it encountered an error in regards to the inner XMLAGG. I tweaked your exampled and ended up with this. Feel free to change if not what you intended to produce.
    SELECT
    XMLELEMENT ("EMPLOYEES",
      XMLAGG(
        XMLELEMENT ("DEPARTMENTS",
          XMLELEMENT ("Department", department_name),
          (SELECT
             XMLAGG (
               XMLELEMENT("EMPLOYEE",
                 XMLFOREST (employee_id AS "Empno",
                            job_id AS "Job",
                            first_name AS "FirstName",
                            last_name AS "LastName",
                            email AS "Email",
                            phone_number AS "Phone"
             FROM employees
            WHERE employees.department_id = departments.department_id
    AS result
    FROM departments

  • Basic AD query

    Hi,
    I'm looking into using Power Query so that I can get up-to-date Active Directory information about our users. I want to be able to extract basic data like names, email addresses, department etc. When I query the user table in Power Query it returns the display
    names of all the users but no other useful columns (it shows things like securityPrinciple and posixAccount though). Is there some simple way I can use Power Query to combine data from multiple AD tables to provide a cohesive view of all our user data?
    I don't know the names of all the fields I want, so I'd rather just extract all the data and figure it out from there.
    Thanks in advance for anyone that can offer any help.

    When you connect to the user table, as you noted, there's a column of displayName and then a bunch of other columns. Are you familiar with the expand button? Most of the other columns in this table are links to other related tables so those columns have
    a little button to the right of the column name that looks like two arrows pointed left and right. Click that and then it will let you choose which of the embedded/related columns that you want to add to your table. I expect that the user, organizationalPerson,
    and person columns probably contain most of the data you want. But if you want to blow out every single column and then go from there (not good for performance but maybe easier to dig through) then just go to each column and click those expand buttons. You
    should end up with a huge table of data for each user.
    This is one of my favorite features in Power Query. It's a great way to dig through a data schema that you're not quite familiar with and pull in related information without worrying about joins and merges.

  • 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

  • Problems with basic spatial query

    I'm trying to learn Oracle Spatial working with 11g R2 and with 3D georeferenced data (specifically data describing buildings in a city).
    But I'm having trouble getting a basic query to work on my dataset (it works for the book example), and I'm trying to do it exactly the way it's done in the Spatial Developer's Guide for 11g.
    To learn how spatial queries work, I set up the cola_markets tables used in the documentation, made the appropriate manual entry in the user_sdo_geom_metadata view and created the index. Having done that, I can run the following simple query (as well as the others in the manual) on the book tables:
    SELECT SDO_GEOM.SDO_DISTANCE(c_b.shape, c_d.shape, 0.005)
    FROM cola_markets c_b, cola_markets c_d
    WHERE c_b.name = 'cola_b' AND c_d.name = 'cola_d';
    but when I try to do the same thing on my own tables (created from citygml data), I get an error. There is the difference that the data is 3D, and the index was created without any PARAMETERS ( ... ), hence is just 2D. But still I don't get why the following query doesn't work:
    SELECT SDO_GEOM.SDO_DISTANCE(c_w.envelope, c_b.envelope, 0.0005)
    FROM cityobject c_w,
    cityobject c_b
    WHERE c_w.id = 50025
    AND c_b.id = 50018;
    The id's for the buildings are valid, and I used the same tolerance used by the software that set up the database.
    Here's the error I get in SQL developer:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.Exception: 54535
    ORA-06512: at "MDSYS.SDO_3GL", line 637
    ORA-06512: at "MDSYS.SDO_GEOM", line 1973
    ORA-06512: at "MDSYS.SDO_GEOM", line 1990
    29532. 00000 - "Java call terminated by uncaught Java exception: %s"
    *Cause: A Java exception or error was signaled and could not be
    resolved by the Java code.
    *Action: Modify Java code, if this behavior is not intended.
    So, thinking it might have something to do with the fact that it's a Java interface, I also tried running it from SQL/PL command line and get essentially the same thing:
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.Exception: 54535
    ORA-06512: at "MDSYS.SDO_3GL", line 637
    ORA-06512: at "MDSYS.SDO_GEOM", line 1973
    ORA-06512: at "MDSYS.SDO_GEOM", line 1990
    Any ideas why this isn't working?

    Hi,-
    There are many ways to model a building with our open 3D data model:
    Please note that each polygon can be any planar surface as long as you dont use
    shortcut definitions like axis-aligned box as Siva mentioned. We dont allow curved surfaces in 3D.
    Gtype 3003 can be composite surface which means each polygon should be connected to another polygon with an edge. Etype must be then 1006. You can have as many polygons as possible as long as they are connected.
    Gtype 3003 can also be a single polygon. But, this will not be able to model a building.
    As you pointed out, maybe it is the footprint of the building.
    You can also model building with gtype 3008 which is simple or composite solid.
    Etype 1007 means it is simple solid and etype 1008 means it is composite solid.
    Composite solid has one or more solids which has at least one full or partial common surface in between.
    In your case with single polygon, you can use sdo_util.extrude as follows to make
    3D buildings. The surfaces created will be on the out-side surface of the building.
    You will not have walls inside the building when you use this following function:
    SELECT SDO_UTIL.EXTRUDE(
      SDO_GEOMETRY(
        2003,
        null,
        null,
        SDO_ELEM_INFO_ARRAY(1,1003,1),
        SDO_ORDINATE_ARRAY(5, 1,8,1,8,6,5,7,5,1)),
      SDO_NUMBER_ARRAY(0,0,0,0,0),
      SDO_NUMBER_ARRAY(5,10,10,5,5),
      0.005) from dual;
    SDO_UTIL.EXTRUDE(SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),SDO_O
    SDO_GEOMETRY(3008, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1007, 1, 1, 1006, 6, 1, 10
    03, 1, 16, 1003, 1, 31, 1003, 1, 46, 1003, 1, 61, 1003, 1, 76, 1003, 1), SDO_ORD
    INATE_ARRAY(5, 1, 0, 5, 7, 0, 8, 6, 0, 8, 1, 0, 5, 1, 0, 5, 1, 5, 8, 1, 10, 8, 6
    , 10, 5, 7, 5, 5, 1, 5, 5, 1, 0, 8, 1, 0, 8, 1, 10, 5, 1, 5, 5, 1, 0, 8, 1, 0, 8
    , 6, 0, 8, 6, 10, 8, 1, 10, 8, 1, 0, 8, 6, 0, 5, 7, 0, 5, 7, 5, 8, 6, 10, 8, 6,
    0, 5, 7, 0, 5, 1, 0, 5, 1, 5, 5, 7, 5, 5, 7, 0))
    The following example returns the three-dimensional composite solid geometry representing an extrusion from a two-dimensional polygon geometry with inner rings.
    SELECT SDO_UTIL.EXTRUDE(
      SDO_GEOMETRY(
        2003,
        null,
        null,
        SDO_ELEM_INFO_ARRAY(1, 1003, 1, 11, 2003, 1,
          21, 2003,1, 31,2003,1, 41, 2003, 1),
        SDO_ORDINATE_ARRAY(0,0, 8,0, 8,8, 0,8, 0,0,
          1,3, 1,4, 2,4, 2,3, 1,3, 1,1, 1,2, 2,2, 2,1, 1,1,
          1,6, 1,7, 2,7, 2,6, 1,6, 3,2, 3,4, 4,4, 4,2, 3,2)),
      SDO_NUMBER_ARRAY(-1.0),
      SDO_NUMBER_ARRAY(1.0),
      0.0001) from dual;
    SDO_UTIL.EXTRUDE(SDO_GEOMETRY(2003,NULL,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1,11,200
    SDO_GEOMETRY(3008, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1008, 4, 1, 1007, 1, 1, 10
    06, 16, 1, 1003, 1, 46, 1003, 1, 91, 1003, 1, 106, 1003, 1, 121, 1003, 1, 136, 1
    003, 1, 151, 1003, 1, 166, 1003, 1, 181, 1003, 1, 196, 1003, 1, 211, 1003, 1, 22
    6, 1003, 1, 241, 1003, 1, 256, 1003, 1, 271, 1003, 1, 286, 1003, 1, 301, 1007, 1
    , 301, 1006, 10, 301, 1003, 1, 328, 1003, 1, 355, 1003, 1, 370, 1003, 1, 385, 10
    03, 1, 400, 1003, 1, 415, 1003, 1, 430, 1003, 1, 445, 1003, 1, 460, 1003, 1, 475
    , 1007, 1, 475, 1006, 6, 475, 1003, 1, 490, 1003, 1, 505, 1003, 1, 520, 1003, 1,
    535, 1003, 1, 550, 1003, 1, 565, 1007, 1, 565, 1006, 10, 565, 1003, 1, 592, 100
    3, 1, 619, 1003, 1, 634, 1003, 1, 649, 1003, 1, 664, 1003, 1, 679, 1003, 1, 694,
    1003, 1, 709, 1003, 1, 724, 1003, 1), SDO_ORDINATE_ARRAY(4, 0, -1, 4, 2, -1, 4,
    4, -1, 3, 4, -1, 2, 4, -1, 2, 7, -1, 1, 7, -1, 1, 6, -1, 1, 4, -1, 1, 3, -1, 0,
    3, -1, 0, 8, -1, 8, 8, -1, 8, 0, -1, 4, 0, -1, 4, 0, 1, 8, 0, 1, 8, 8, 1, 0, 8,
    1, 0, 3, 1, 1, 3, 1, 1, 4, 1, 1, 6, 1, 1, 7, 1, 2, 7, 1, 2, 4, 1, 3, 4, 1, 4, 4
    , 1, 4, 2, 1, 4, 0, 1, 4, 0, -1, 8, 0, -1, 8, 0, 1, 4, 0, 1, 4, 0, -1, 8, 0, -1,
    8, 8, -1, 8, 8, 1, 8, 0, 1, 8, 0, -1, 8, 8, -1, 0, 8, -1, 0, 8, 1, 8, 8, 1, 8,
    8, -1, 0, 8, -1, 0, 3, -1, 0, 3, 1, 0, 8, 1, 0, 8, -1, 0, 3, -1, 1, 3, -1, 1, 3,
    1, 0, 3, 1, 0, 3, -1, 1, 3, -1, 1, 4, -1, 1, 4, 1, 1, 3, 1, 1, 3, -1, 1, 4, -1,
    1, 6, -1, 1, 6, 1, 1, 4, 1, 1, 4, -1, 1, 6, -1, 1, 7, -1, 1, 7, 1, 1, 6, 1, 1,
    6, -1, 1, 7, -1, 2, 7, -1, 2, 7, 1, 1, 7, 1, 1, 7, -1, 2, 7, -1, 2, 4, -1, 2, 4,
    1, 2, 7, 1, 2, 7, -1, 2, 4, -1, 3, 4, -1, 3, 4, 1, 2, 4, 1, 2, 4, -1, 3, 4, -1,
    4, 4, -1, 4, 4, 1, 3, 4, 1, 3, 4, -1, 4, 4, -1, 4, 2, -1, 4, 2, 1, 4, 4, 1, 4,
    4, -1, 4, 2, -1, 4, 0, -1, 4, 0, 1, 4, 2, 1, 4, 2, -1, 0, 3, -1, 1, 3, -1, 1, 1,
    -1, 2, 1, -1, 3, 2, -1, 4, 2, -1, 4, 0, -1, 0, 0, -1, 0, 3, -1, 0, 3, 1, 0, 0,
    1, 4, 0, 1, 4, 2, 1, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 3, 1, 0, 3, 1, 0, 3, -1, 0, 0
    , -1, 0, 0, 1, 0, 3, 1, 0, 3, -1, 0, 0, -1, 4, 0, -1, 4, 0, 1, 0, 0, 1, 0, 0, -1
    , 4, 0, -1, 4, 2, -1, 4, 2, 1, 4, 0, 1, 4, 0, -1, 4, 2, -1, 3, 2, -1, 3, 2, 1, 4
    , 2, 1, 4, 2, -1, 3, 2, -1, 2, 1, -1, 2, 1, 1, 3, 2, 1, 3, 2, -1, 2, 1, -1, 1, 1
    , -1, 1, 1, 1, 2, 1, 1, 2, 1, -1, 1, 1, -1, 1, 3, -1, 1, 3, 1, 1, 1, 1, 1, 1, -1
    , 1, 3, -1, 0, 3, -1, 0, 3, 1, 1, 3, 1, 1, 3, -1, 1, 6, -1, 2, 6, -1, 2, 4, -1,
    1, 4, -1, 1, 6, -1, 1, 6, 1, 1, 4, 1, 2, 4, 1, 2, 6, 1, 1, 6, 1, 1, 6, -1, 1, 4,
    -1, 1, 4, 1, 1, 6, 1, 1, 6, -1, 1, 4, -1, 2, 4, -1, 2, 4, 1, 1, 4, 1, 1, 4, -1,
    2, 4, -1, 2, 6, -1, 2, 6, 1, 2, 4, 1, 2, 4, -1, 2, 6, -1, 1, 6, -1, 1, 6, 1, 2,
    6, 1, 2, 6, -1, 1, 3, -1, 2, 3, -1, 2, 4, -1, 3, 4, -1, 3, 2, -1, 2, 1, -1, 2,
    2, -1, 1, 2, -1, 1, 3, -1, 1, 3, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 3, 2, 1, 3, 4, 1,
    2, 4, 1, 2, 3, 1, 1, 3, 1, 1, 3, -1, 1, 2, -1, 1, 2, 1, 1, 3, 1, 1, 3, -1, 1, 2
    , -1, 2, 2, -1, 2, 2, 1, 1, 2, 1, 1, 2, -1, 2, 2, -1, 2, 1, -1, 2, 1, 1, 2, 2, 1
    , 2, 2, -1, 2, 1, -1, 3, 2, -1, 3, 2, 1, 2, 1, 1, 2, 1, -1, 3, 2, -1, 3, 4, -1,
    3, 4, 1, 3, 2, 1, 3, 2, -1, 3, 4, -1, 2, 4, -1, 2, 4, 1, 3, 4, 1, 3, 4, -1, 2, 4
    , -1, 2, 3, -1, 2, 3, 1, 2, 4, 1, 2, 4, -1, 2, 3, -1, 1, 3, -1, 1, 3, 1, 2, 3, 1
    , 2, 3, -1))These are examples from Spatial User's Guide.
    ORA-54668 means that you need to update your srid to a 3D srid.
    Please check out Spatial User's Guide, Pro Oracle Spatial for 11g book and
    the following paper (which we can send you a copy offline)
    B. M. Kazar, R. Kothuri, P. v. Oosterom and S. Ravada, "On Valid and Invalid Three-
    Dimensional Geometries", 2nd International Workshop on 3D Geo-Information: Requirements, Acquisition,
    Modelling, Analysis, Visualisation, 12-14 December 2007, Delft, the Netherlands (Published as Chapter 2,
    pp. 19-46 in Advances in 3D Geoinformation Systems Series: Lecture Notes in Geoinformation and
    Cartography Oosterom, P.v.; Zlatanova, S.; Penninga, F.; Fendel, E. (Eds.) 2008, XX, 441 p. 235 illus.,
    Hardcover ISBN: 978-3-540-72134-5
    Maybe if you can post here an example geometry from your data,
    we can help you more.
    Hope these help.
    Thanks

  • Basic Spatial Query

    Hi guys,
    I am currently developing a java applet to display telecommunication sites taken from an Oracle 8.1.6 DB. The company I work for also happens to have the spatial cartridge which I intend to use to overlay a country map over my plottings. I have imported the map data into a table, and I can view the GEOLOC information as a huge stream of longs and lats via a simple SELECT query in SQLPLUS - so the data has been imported correctly.
    I have tried to digest huge articles on querying spatial information - however, unfortunately being an Oracle novice, it has left me quite dazzled.
    Basically all I want to do is take from my spatial table a list of long and lat coordinates (in double format) in a specific physical area, so that I can display them from there.
    I'd appreciate any help that anyone could give.
    null

    Hi David,
    There are a few things you will have to do in order to get this to work quickly.
    1) You will have to insert data into the user_sdo_geom_metadata field so Oracle Spatial can know some information about the data you've created (table name, spatial column name, information about upper and lower bounds as well as tolerance for each dimension.
    2) You'll need to create a spatial index on the data.
    3) You'll need to analyze the spatial index table.
    4) Then you can query the data. You'll have to decide whether you need exact answers (using the sdo_relate operator) or approximate answers based only on the index (sdo_filter operator).
    There is too much information required to put it all here, but I'll include a few samples.
    to insert data into user_sdo_geom_metadata:
    insert into user_sdo_geom_metadata values ('TABLE_NAME','GEOMETRY_COLUMN_NAME',
    mdsys.sdo_dim_array(mdsys.sdo_dim_element('X',-180.0,180,0.00000005),
    mdsys.sdo_dim_element('Y',-90,90,0.00000005)),NULL);
    commit;
    In the above example, TABLE_NAME is the name of the table with your geometry column, then the geometry column name, then the dimarray has attributes in it associated with each of two dimensions (two dimensional data is stored here), the first dimension has a lower bound of -180, and upper bound of 180, and a tolerance or 0.00000005 (the decimal precision of your data, with a 5 appended), the second dimension has the info supplied, and the last null means there is no coordinate system stored with the data. I'd suggest if you are a newbie to leave it as NULL, then ease into coordinate systems once you get more experience.
    2) create the index
    create index table_name_sidx
    on table_name(geometry_column_name)
    indextype is mdsys.spatial_index
    parameters('sdo_level=x');
    where x is usually a number between 6 and 14 based on the type of data you have. There is a lot to say about this, but I can't say it here.
    3) analyze the spatial index table:
    from sql*plus, run the following statements:
    set head off
    spool analyze_it.sql
    select ' analyze table ' | | sdo_index_table | | ' estimate statistics sample 32 percent;'
    from user_sdo_index_metadata order by sdo_index_table;
    spool off;
    @analyze_it.sql
    4) execute a query based on an area of interest:
    this statement will return all geometries that have any interaction with a query window specified by a rectangle with bounds
    2,2, 10,2, 10,10, 2,10, 2,2
    SELECT geometry_column_name
    FROM table_name
    where sdo_relate (geometry_column_name,
    mdsys.sdo_geometry(2003,NULL, NULL
    mdsys.sdo_elem_info_array(1,1003,1),
    mdsys.sdo_ordinate_array (2,2, 10,2, 10,10, 2,10, 2,2)),
    'mask=anyinteract querytype=window'
    = 'TRUE';
    You will have to dig more into each of these subject to understand them.
    Hope this helps,
    dan
    null

  • Basic media query

    This is driving me to distraction, can anybody tell me why the extremely basic coding does not show correctly in the Multiscreen view for mobile.:
    The CSS:
    @charset "UTF-8";
    /* CSS Document */
    .container {
              width: 500px;
    .content {
              float: left;
              width: 235px;
              margin-top: 0px;
              margin-right: 15px;
              margin-bottom: 0px;
              margin-left: 0px;
              background-color: #900;
              height: 40px;
    @media only screen and (max-device-width: 320px) {
              .container {width: auto;}
              .content {
                        float:none;
                        margin: 0;
                        width: auto;
    and the html:
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Untitled Document</title>
    <link href="basic_mobile.css" rel="stylesheet" type="text/css" media="screen">
    <body>
    <div class="container">
    <div class="content"></div>
    <div class="content"></div>
    </div>
    </body>
    </html>
    Despite the media screen query canceling the Float it refuses to sit on on top of the other in the browser.
    Apologies for the basic nature of this but it is a sticking point.
    Ian

    Hi
    Not certain what you mean when you say,"shouldn't the two divs still stop floating though in the smaller browser window?", as the position of the divs are on the left by default in a browser, so they may give the impression of floating left, (try float right).
    Insert some text into the content div.
    PZ

  • 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-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

  • Basic question - querying xmltype column

    Hi,
    Sorry for the basic question but please could someone paste in a working 'select where' statement which will pick out only those rows containing an element with specified content.
    For example, how would I return n complete XML documents as query results for a situation where 'element_1' has text content 'apples'?
    This does not seem to work:
    SELECT x.xml_body.extract('/root_element/element_1/text()').getStringVal()
    FROM xmltable x
    WHERE x.xml_body.extract('/root_element/element_1/text()').getStringVal()='apples'

    Hi Paul,
    The query you have given works. I tried that query in the following format and it works.
    Query 1:
    SELECT x.xmlcol.extract(/Employee/Name/text()').getStringVal()
    FROM table_name x
    WHERE x.xmlcol.extract('/Employee/Name/text()').getStringVal()='Anu'
    Query 2:
    SELECT extractvalue(x.xmlcol,'//Name/text()')
    FROM table_name x
    WHERE extractvalue(x.xmlcol,'//Name/text()')='Srini'
    Both the queries work. The xml is of the following format
    <Employee company="Oracle">
    <Name>Anu</Name>
    <Department>OTN</Department>
    <Location>India</Location>
    </Employee>
    Can you please tell the database version on which you are working?
    For more information on XMLType you can refer the XMLDB Samples located at
    http://otn.oracle.com/sample_code/tech/xml/xmldb/content.html
    You can also refer to the XMLType Sample present at this location
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/9i_jdbc/content.html#xmltype
    to know how to work with XMLType columns.
    You can get back to us if you have any more doubts.
    Regards,
    Anupama Majety

  • Basic select query with round

    Hello everyone,
    I am very new to Oracle. I have a query that i use for getting table space statistics;
    Here is my query;
    "select * from dba_tablespace_usage_metrics"
    This returns me the data that i want it.
    like;
    TABLESPACE_NAME USED_SPACE TABLESPACE_SIZE USED_PERCENT
    PRRFK 52543200 57647104 91.14629591800483160437686514
    How can edit my query to show me the USED_PERCENT in 4 digit rather than long digits
    such as 91.14
    Any input greatly appreciated.
    Thank you.

    yes that what i am looking for but could not figure out where to put in the query.
    can you please put in the full query?
    Here is my actual query;
    select * from dba_tablespace_usage_metrics
    Thank you.

  • Basic Schema inquiry

    My organization is considering combining 2 schema's into one. Each schema is mostly used by the corresponding subdepartment, but we also access each other's schema's without restrictions. I am not DBA, but I hope to do some PL/SQL programming which would transfer some records from one schema to another.
    First, please clarify me on following. Everyone (non-technical management) refers to these schema’s as “Databases”. But my guess is that these are different schemas located in the same database.
    To access the two schemas I type something like:
    sqlplus username1/password1@aaa (for one)
    sqlplus username2/password2@aaa (for another)
    I saw online that the “@aaa” part refers to the Instance of Oracle. My shaky understanding is that an instance can contain multiple databases. In that case, these could be different schemas, which are also located in different databases (in that case, everyone is right).
    So my first question is: how do I know to which Database I am connected when I access these schemas?
    Assuming that these are two schema’s in the same database, what would I need to program between schemas? Would it be enough, if the DBA assigned permissions for each username to access/modify another schema?
    Is there truth to saying that combining 2 schema’s into one increases performance? What are other pros and cons?
    Thanks a lot! I asked a lot of questions.
    -John

    So my first question is: how do I know to which Database I am connected when I access these schemas?In Oracle, 1 instance = 1 database. And 1 database = several schemas = several user accounst = several namespaces.
    In Oracle CREATE DATABASE statement creates 1 and only 1 database. Very different from SQL Server/Sybase/MySQL.
    In both cases, you database is "aaa" and
    sqlplus username1/password1@aaa (for one) => current schema is username1
    sqlplus username2/password2@aaa (for another) => current schema is username2
    what would I need to program between schemas?You need to grant required privileges to the other user and to prefix each object with the schema name in your queries.
    Would it be enough, if the DBA assigned permissions for each username to access/modify another schema?Yes
    Is there truth to saying that combining 2 schema’s into one increases performance? What are other pros and cons?> I don't know.

  • Basic sql query

    Hi all, I am trying to get a report using sql, but I do not get the data out.
    Select data1, sum(data2)
    from table1
    where date1 between '01-JAN-2007' and '01-JAN-2009'
    group by data1
    I know I have data because the query runs in sql+
    I do not get any error message, the reports is just empty.
    Can someone help me to understand what I am doing wrong?
    Many thanks
    Maria

    Hi,
    I thought you were using SQL server 2005, anyways if you are firing your query against Oracle, try this.
    Select data1, sum(data2)
    from table1
    where
    to_date(to_char(date1,'YYYY-MM-DD'),'yyyy/mm/dd') between
    to_date('2007/01/01','yyyy/mm/dd') and to_date('2009/01/01','yyyy/mm/dd')
    group by data1
    >>What is the problem with dates between Crystal reports and oracle databases?
    The problem is that when you compare the dates in strings then you need to provide them in the same format the date is stored with though you get in 'DD/MM/YYYY' on select but it is not necessarily be that, Thanks.
    Hope this helps.
    Thanks
    -Azhar

  • Basic negociation query

    Dear All,
    I had some queries running in my mind which iam sure could be cleared in this forum :)
    My scenario is like this...
    Client-1(b mode)------ AP(auto or mixed mode) ------ Client-2(g mode)
    Now suppose Client-1 wants to transfer data to client-2 via AP, what would be the rate of transfer of data
    a) 11 Mbps (b mode) - lowest of the two rates
    b) 11 Mbps (b mode) from Client-1 to AP and 54Mbps from AP to Client-2 and vice versa.
    can someone pl throw some light here.
    looing forward for your replies.
    - Queenie

    When you configure the 802.11g access point radio for best throughput, the access point sets all data rates to basic (required). This setting blocks association from 802.11b client devices. The best throughput option appears on the web-browser interface Express Setup and Radio Settings pages and in the speed CLI configuration interface command.
    The wireless device always attempts to transmit at the highest data rate that is set to Basic. If there are obstacles or interference, the wireless device steps down to the highest rate that allows data transmission.
    The data rates supported on an IEEE 802.11b, 2.4 GHz radio are 1 Mbps, 2 Mbps, 5.5 Mbps and 11 Mbps.
    The data rates supported on an IEEE 802.11g, 2.4 GHz radio are 1 Mbps, 2 Mbps, 5.5 Mbps, 6 Mbps, 9 Mbps, 11 Mbps, 12 Mbps, 18 Mbps, 24 Mbps, 36 Mbps, 48 Mbps and 54 Mbps.
    The data rates supported on an IEEE 802.11a, 5 GHz radio are 6 Mbps, 9 Mbps, 12 Mbps, 18 Mbps, 24 Mbps, 36 Mbps, 48 Mbps and 54 Mbps.

Maybe you are looking for