The analysis of SQL query

Hi all

In addition to the discussion of yesterday (https://community.oracle.com/message/11317343#11317343)

For a list of the table used in the SQL query, there is another way.

If we plan to explain for the query command, table plan we will be able to get all the table names.

But in the query, if we used all the views, the tables used in the underlying views are also the list.

I don't know how to do to get the name of view only, not the names of the underlying tables.

Thank you

Manon...

Dint you pick me up I guess. If you see the plan for performance that I posted you will find oracle have not all table EMP scan. There is therefore no reference to the EMP table in the PLAN_TABLE.

SQL > delete from plan_table;

0 rows deleted.

SQL > explain the plan for
2. Select empno in emp;

He explained.

SQL > select * from plan_table where object_type = "TABLE";

no selected line

Tags: Database

Similar Questions

  • The Variable value based on the results of SQL query

    With the help of OBIEE 11.1

    Is it possible to set the value of a variable presentation of the results of a SQL statement?

    Scenario:

    I have 2 topics.

    SubjectArea1

    Text1

    Date1

    SubjectArea2

    Field1

    Field2

    UpdateDate

    I have an analysis that uses only the SubjectArea2.

    Using a dashboard quickly, the user must be able to select Text1 in the other topic area (SubjectArea1).

    Assuming that selection will be stored in a variable of presentation (SelectedText),

    The filter in the analysis should be something like

    Upper UpdateDate to @{SelectedDate}

    How can I set a variable (SelectedDate) using a SQL statement?

    Something like this:

    SELECT "Date1" TO "SubjectArea1" WHERE "Text1" = @{SelectedText}

    So the command prompt text selection should give a date that is used to filter the second review?

    If so:

    The prompt on SA1.textCol

    hidden analysis who is invited on SA1.texCol has SA1.dateCol in the criteria

    Analysis SA2.dateCol is filetered on basis of the results of another analysis (any value analysis hidden SA1.dateCol)

  • between the clause of sql query?

    Hi all

    After sql query using a report.
    ------------------------------------------------

    Select trunc (m.spc_doc_date) prod_date, sum (nvl(d.req_qty,0)) order_qty, sum (nvl(d.spc_item_qty,0)) prod_qty
    of spc_ppc_daily_m m, spc_ppc_daily_d d
    where m.spc_doc_ # in (select spc_doc_ # to spc_ppc_daily_m)
    - and d.blce_qty > 0
    and m.spc_locn_code =: locn_code
    and m.spc_doc_date between: TO_date and: FROM_date
    and m.spc_locn_code = d.spc_locn_code
    and m.spc_doc_ #= d.spc_doc_ #.
    and (m.obu =: obu OR: OLGA IS NULL)
    and (m.customer =: customer OR: CUSTOMER IS NULL)
    Trunc Group (m.spc_doc_date)
    order of trunc (m.spc_doc_date)

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

    "When I use to_date = 22 February 2012 ' from_date = February 22, 2012"
    There is no pick up. (acually documents are there on February 22, 2012)

    "When I use to_date = 22 February 2012 ' from_date = February 23, 2012"
    now shows data of February 22, 2012.

    I have replace between it of > = & < =, same result two cases respectively.

    Why?

    Thank you
    Yoann

    date you hours minutes and seconds
    then

    use
    trunc (m.spc_doc_date)

    or to: from_date in the parameter after form convert to February 23, 2012 23:59:59 '

  • How can I parse the XML file using the Oracle's Sql query.

    Hi all
    I have an XML file that must analyze and display the result according to the following example
    Can you please recommend me an approach to get the result.

    For example, here is my XML:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < xmlns:pi = "urn:com.workday / picof pi: Extract_Employees" >
    < IP: employee >
    < Additional_Information: pi > < pi: pi function: PriorValue = "" > Intern - masteri¿½s < / pi: function >
    < / pi: Additional_Information >
    < / pi: employee >
    < / pi: Extract_Employees >

    Databases:

    Oracle Database 10 g Enterprise Edition release 10.2.0.3.0 - production

    SQL > SELECT * FROM NLS_DATABASE_PARAMETERS;

    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS.,.
    WE8ISO8859P1 NLS_CHARACTERSET
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI. SSXFF AM
    NLS_TIMESTAMP_FORMAT-DD-MON-RR HH.MI. SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI. SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI. SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    BINARY NLS_COMP
    NLS_LENGTH_SEMANTICS BYTES
    NLS_NCHAR_CONV_EXCP FAKE
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 10.2.0.3.0



    The Xml file above with UTF-8 character sets which is multi bytes.

    But in my character database is WE8ISO8859P1 for example ISO-8859-1 (single-byte character set)

    SQL > SELECT extractValue (Value (x) ', ' / pi:Employee/pi:Additional_Information/pi:Job_Title','xmlns:pi="urn:com.workday/picof ' ')
    TABLE (XMLSequence (extract (XMLType (bfilename('XMLDIR','XML_Issue_227176.xml'), nls_charset_id ('AL32UTF8')),'/ pi: Employee ',' xmlns:pi="urn:com.workday/picof"'))) x;)))


    which gives the following error:

    Error:
    ORA-31011: XML parsing failed
    ORA-19202: an error has occurred in the processing of XML
    LPX-00200: could not convert from UTF-8 encoding to ISO-8859-1
    Error on line 1
    ORA-06512: at "SYS." XMLTYPE", line 295
    ORA-06512: at line 1

    Also I tried with this
    SQL > SELECT convert (extractValue (Value (x), ' / pi:Employee/pi:Additional_Information/pi:Job_Title','xmlns:pi="urn:com.workday/picof"'),'WE8ISO8859P1 ', 'UTF8'))
    TABLE (XMLSequence (extract (XMLType (bfilename('XMLDIR','XML_Issue_227176.xml'), nls_charset_id ('AL32UTF8')),'/ pi: Employee ',' xmlns:pi="urn:com.workday/picof"'))) x;)))

    The same error is according to the above error message.

    Please help in this regard.

    Thank you and best regards,
    Sandrine

    You know the code of real character behind "" or you receive the file like that?

    For the record, "" is the wildcard of UTF-8 (0xEFBFBD), so that the original character of the means has already been replaced and that very probably the file was not coded properly in the first place.

    With respect to the resolution of the problem, try another method to read the file:

    SQL> select value from nls_database_parameters where parameter = 'NLS_CHARACTERSET';
    
    VALUE
    ----------------------------------------
    WE8ISO8859P15
    
    SQL> SELECT x.*
      2  FROM XMLTable(
      3         XMLNamespaces(default 'urn:com.workday/picof')
      4       , '/Extract_Employees/Employee'
      5         passing xmltype(
      6                   dbms_xslprocessor.read2clob(
      7                     'COP_DIR'
      8                   , 'XML_Issue_227176.xml'
      9                   , nls_charset_id('AL32UTF8')
     10                   )
     11                 )
     12         columns job_title varchar2(30) path 'Additional_Information/Job_Title'
     13       ) x
     14  ;
    
    JOB_TITLE
    ------------------------------
    Intern -  Master¿s
     
    
  • The Web-based SQL Query Builder

    Hello

    I have a generator of SQL query that allows users to create their own application graphically.

    I have something I could use to do?

    Thanks a lot for your help
    Jko

    Hello

    I hope this help you start your applications to Query Builder
    http://HTMLDB.Oracle.com/pls/OTN/f?p=18326:7:1636417102512483:P7_ID:161

    BR, Jari

    Edit:

    And this
    http://HTMLDB.Oracle.com/pls/OTN/f?p=18326:7:1636417102512483:P7_ID:1222

    Published by: jarola October 29, 2009 12:30 AM

  • reload the page when SQL query returns a value

    Hello world

    the title of this discussion may seem strange, but I'll try to explain why I need this:

    A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.

    Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.

    Thank you!

    Here is an overview of how it can be done

    This is possible thanks to a dynamic action being performed on a timer.

    View default tabs and dynamic action hide them on loading the page if they are not to be considered

    Create a dynamic action that will execute your query every 5 seconds or more

    If the query returns data, you can use the dynamic action to show your tabs using javascript

  • get the node of SQL query file name

    Hi all
    I have a concurrent request that requires the name of file as input. For example, when I connect to oracle on our test instance, I use http://moon1.oando-plc.com:8000. For this program at the same time, the node file name appears as moon1.oando - plc.com.
    I need to use this argument to a PL/SQL procedure, that I write and I don't want to use any hard coding.
    Is it possible to get this data into an SQL statement.

    Thank you

    Hello

    You can get table ICX_PARAMETERS (HOME_URL column). Orsearch profile options values for 'http' get the login page URL (or server name) - see (Note: 201945.1 - How E-Business Suite profile Option values list for all levels using SQLPlus).

    Kind regards
    Hussein

  • SQL query to retrieve a single record for each employee of the following table?

    Hi all

    Help me on the writing of SQL query to retrieve a single record for each employee of the following table? preferably a standard SQL.

    CREATE TABLE xxc_contact)

    empnum NUMBER,

    alternatecontact VARCHAR2 (100),

    relationship VARCHAR2 (10),

    phtype VARCHAR2 (10),

    Phone NUMBER

    );

    insert into xxc_contact values (123456, 'Rick Grimes', 'SP', 'Cell', 9999999999)

    insert into xxc_contact values (123456, 'Rick Grimes', 'SP', 'Work', 8888888888)

    insert into xxc_contact values (123457, 'Daryl Dixon', 'EN', 'Work', 7777777777)

    insert into xxc_contact values (123457, 'Daryl Dixon', 'EN', 'Home', 3333333333)

    insert into xxc_contact values (123456, 'Maggie Greene', 'CH', 'Cell', 9999999999)

    insert into xxc_contact values (123456, 'Maggie Greene', 'CH', 'Home', 9999999999)

    expected result:

    EmpNum AlternateContact Relationship PhType Phone       

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    Thanks in advance.

    994122 wrote:

    Thank you all, that I got a result

    http://www.orafaq.com/Forum/m/620305/#msg_620305

    By Lalit Kumar B...

    Specifically, the two simple solutions provided were:

    1 using the row_number, entitled Oracle ranking based on descending order of the inside telephone each empnum group. And finally selects the lines which has least rank (of least since that order is descending for phone).

    SQL > column alternatecontact format A20;

    SQL >

    SQL > SELECT empnum, alternatecontact, relationship, phtype, phone

    2 from (SELECT a.*, row_number() over r (PARTITION BY empnum ORDER BY phone / / DESC))

    3 FROM xxc_contact one)

    4. WHEN r = 1

    /

    EMPNUM ALTERNATECONTACT RELATIONSHIP PHTYPE PHONE

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

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    2. with the help of MAX, Oracle automatically assigns the maximum phone for all the rows in each group of empnum. And finally selects the rows with the maximum phone. Order by clause is omitted here intentionally. You can find out why.

    SQL > SELECT empnum, alternatecontact, relationship, phtype, phone

    2 (SELECT a.*, MAX (phone) over (PARTITION BY empnum) rn FROM xxc_contact one)

    3 WHERE phone = rn

    4.

    EMPNUM ALTERNATECONTACT RELATIONSHIP PHTYPE PHONE

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

    123456 rick Grimes SP cell 9999999999

    Daryl Dixon EN work 7777777777 123457

    Home 123458 Maggie Greene CH 6666666666

    Kind regards

    Lalit

  • Dynamic SQL query in the DB adapter

    Hello
    I want to use the following custom SQL query in the DB adapter:

    SELECT EMP_ID, EMP_NAME, EMP_LOCATION FROM EMP WHERE EMP_ID IN (#iNPUT_PARAMETER)

    the problem I'm facing is that I don't know at the time of the development that EMP_ID how much will be passed to the process so that I can not use the input parameter specific number. I cannot use it IN the query within which statement I concatenate all the EMP_ID separated by comma and passed under INPUT_PARAMETER, but when running, he read the full concatenated string as a single string rather than identify them as a list of different: with comma separation. could someone help me in this case

    Thank you
    Sunil

    Use the following query with two parameters. Build the string with delimiter when running and pass this string and delimiter to query... (in this example, the input value would be the same for both Delimiter1 and Delimiter2.)

    Select * from EMP WHERE deptno IN (SELECT SUBSTR (STRING_TO_TOKENIZE, DECODE (LEVEL, 1, 1, INSTR (STRING_TO_TOKENIZE, SEPARATOR, 1, LEVEL-1) + 1), INSTR (STRING_TO_TOKENIZE, SEPARATOR, 1, LEVEL)-DECODE (LEVEL, 1, 1, INSTR (STRING_TO_TOKENIZE, SEPARATOR, 1, LEVEL-1) + 1)) FROM (SELECT #StringToTokenizer | #Delimiter1 AS STRING_TO_TOKENIZE, #Delimiter2 AS DELIMITER FROM DUAL) CONNECT BY INSTR (STRING_TO_TOKENIZE SEPARATOR) ((, 1, LEVEL) > 0)

    Thank you
    -Sreeny

  • Execution of the SQL query through 2 different databases to Oracle

    Hi all

    In Microsoft SQL server, we can run on 2 different databases depending on the type of SQL query:

    Select * from TEST1.dbo.GENERIC_TABLE1 union select * from TEST2.dbo.GENERIC_TABLE2;

    Test1 and TEST2 here is 2 different databases.

    Can we do the same in Oracle?

    Of course you can do it.
    Create a [database join | http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_5005.htm] from DB1 to DB2.

    Grant select on the tables of the DB2 schema with which you want to connect.

    And then, you can you can query as

    select * from DB1schema.emp
    union
    select * from emp@dblink_name;
    
  • the analysis of this sql help

    Hello

    I need help in the analysis of this query effectively

    Field1, Field2
    1, a
    2, a
    b 3,
    b 3,
    4, c.


    I want my query to return 1, a and 2 a because Field2 appeared several times with different values of field1. Please advice. It is a discrepancy report.
    WITH tab AS
      ( SELECT 1 field1,'a' field2 FROM dual
    UNION ALL
       SELECT 2 field1, 'a' field2 FROM dual
    UNION ALL
       SELECT 3 field1, 'b' field2 FROM dual
    UNION ALL
       SELECT 3 field1, 'b' field2 FROM dual
    UNION ALL
       SELECT 4 field1, 'c' field2 FROM dual
      )
     SELECT field1,
      field2
       FROM
      (SELECT field1                                ,
        field2                                      ,
        COUNT(field1) over (partition BY field2) cn1,
        COUNT(DISTINCT field1) over (partition BY field2) cn2
         FROM tab
      )
      WHERE cn1=cn2 and cn1!=1
    

    Ravi Kumar

  • SQL query + html

    Hello

    I have a test_table (col1, col2, col3) on apex.oracle.com.

    First of all:

    I would like to create report as the type of SQL query:

    Select col1, col2, col3 from test_table;

    I want to change the properties of the col2 for example the font or color during the generation.

    I have to write in the report source code (this is only an example?):

    Select col1,

    "< span style =" ' make-weight: bold; ' > ' col2 "</span >", "

    COL3

    from test_table;

    I think it's wrong, but I would like to know what are the first principles of the connection between sql and html.

    Second:

    I create the report in the body of type SQL query return PLSQL function:

    Start

    return "select col1.

    || "< span style =" ' make-weight: bold; ">" | 'col2' | ' </span >', "

    ||' COL3

    from test_table;';

    end;

    What is the problem in the two examples? I can't find it in the documentation. Could you tell me something about the principles.

    Concerning

    Ziut

    Hello

    One way is to query as

    select col1,
    col2,
    col3,
    case when col1 = 'XXX' then
     'bold'
    else
     'normal'
    end as fontweight
    from test_table;
    

    Column of FONTWEIGHT set as hidden.

    Then place the COL2 HTML expression

    #COL2#
    

    Kind regards

    Jari

  • SQL query as a filter in OBIEE

    I have a list of student_ID in a table (say A) and its subset in another table (table B)
    I want a filter so that only the student_ID in table A that are not in table B are selected.

    I'm selecting operator "not equal to / is not" of the student_id in table A and choose the option to SQL query to add value.

    Select distinct student_id from DatabaseName.B

    His does not work. His error after a large number of minor changes.

    Can you help how to solve this problem

    Try something like
    http://www.cool-bi.com/tweaks/JoinsinAnswers.php

    Use not exists or not instead of join.

    If brand aid

  • Report model 101 - bubbles of commentary (used during the creation of SQL report)

    Hello

    There is a type of report - comment bubbles [Theme - 24, 25, 26]
    Has anyone tried creating SQL report using this model.

    OR if anyone knows how to use it and what should be the syntax of SQL query for the use of this model.

    Thank you
    Deepak

    Hi Deepak.

    I guess you run APEX 4.2
    There is a packaged application included with 4.2 that is called 'Customer Tracker'
    Page 50, you will find a rewgion where these how bubles are used (unlock the app to view the source).

    Concerning
    Bottom

  • Data model - SQL query

    Hello world

    I hope someone can point me in the right direction.

    I have the SQL code following in the type of SQL query data model.

    Select * from ap_invoices

    The following select statement is not to return all the rows in the view, but the fact of sqlplus.

    I have setup the EBS security model uses BEEP 10.1.3.4.1.


    What I do wrong, is there some setting I'm missing?

    Do I need to use a different security model to BEEP?

    Help, please
    Thank you.

    Hello

    AP_INVOICES is a view as you know, sound based on the ORG_ID set when you select from it. IM thinking that when you use just select * from AP_INVOICES at RANDOM. Its not abreast of your org id and its is not defining for you when you run a query, so its not rehired data. Two options:

    1. use a data model and in the pre-reading trigger set the context of the org. As you may be in an Oracle report. Data models are very powerful and offer everything that OReports done in EBS incl. triggers flex extensions

    2 use the AP_INVOICES_ALL table and set the org id in the query where clause.

    Both approaches need so that you know the id org that you want to set. The integration of the security that you won't it's to say it does not pass it when the user opens a session. I suppose you have a report folder for every responsibility you could hardcode the org id in the reports in a given folder. Or you can add it as a parameter to the user to fill out report.
    Integration level just does not quite go enough away for the time to manage the org and, therefore, the views of the org.

    hope this is clear

    Concerning

    Tim

Maybe you are looking for