Find the name of the view based on a sql query

Can anyone suggest me how to find the name of the view based on a sql query? When I try to the following select statement:
select view_name from user_views where text like '%SELECT * from TABLE%';
but I get this error:
SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got LONG
00932. 00000 -  "inconsistent datatypes: expected %s got %s"
But as I notice that the TEXT column is really LONG to type... Are there any other table system that store information about the text using each view?

See this example, using DBMS_METADATA. GET_DDL:

Re: Search text in column

Tags: Database

Similar Questions

  • Create the worksheet based on a Sql query

    Hello

    I use SQL Developer Version 1.5.5.
    I want to run 3 different sql queries and then to get the result in the worksheet 3 in a xls.
    Now, when I run the query in the results tab.
    Yes
    Right-click-> export data-> xls
    But the results come in 3 xls and not as as I want. Is it possible to do?

    Thank you

    You can export as text to the Clipboard and paste the results yourself in Excel.

    Have fun
    K.

  • Is there a way I can find the AUTHID set of PL/SQL?

    If I am logged in as A user and I have a query a view that calls a function of authid DEFINER belonging to user B, and it called as a function of the user current authid owned by C that I am not some priivileges of the user whose second service runs under. I think it should be A but y at - it a routine system that I can call that tells me for certain that it is?
    Keith.

    Is there a way I can find the AUTHID set of PL/SQL?

    You can view the current_schema:

    SQL> create or replace procedure p1
       authid definer
    as
    begin
       dbms_output.put_line ('P1 :' || sys_context ('userenv', 'current_schema'));
    end p1;
    /
    Procedure created.
    
    SQL> create or replace procedure p2
       authid current_user
    as
    begin
       dbms_output.put_line ('P2 :' || sys_context ('userenv', 'current_schema'));
    end p2;
    /
    Procedure created.
    
    SQL> grant execute on p1 to scott
    /
    Grant complete.
    
    SQL> grant execute on p2 to scott
    /
    Grant complete.
    
    SQL> connect scott/tiger@oracle
    Connected as SCOTT@oracle
    
    SQL> exec michael.p1
    P1 :MICHAEL
    PL/SQL procedure successfully completed.
    
    SQL> exec michael.p2
    P2 :SCOTT
    PL/SQL procedure successfully completed.
    
  • Calculation of the time wall of a SQL query.

    Hello

    While trying to discover the time of running a SQL query (wall time) I read in one place that CPU_TIME/EXECUTIONS of v$ SQLAREA, is the precise runtime we can come close to.

    I can't use "set timing on ' or 'DBMS_UTILITY. GET_TIME' that I need to extract the execution time of the story because the query will be drawn to an end, and I need to know how long it took to DB level and compare it with the end time before calculating the % of time used in the DB level total.

    Maybe another way to track sessions and the user TKPORPOF but now I donot want to take the help of the ADMINISTRATOR at this initial stage.

    Is CPU_TIME/EXECUTIONS of v$ SQLAREA where (SQL_TEXT) AS "SELECT... OF... %'; should be enough?

    user2925917, yes as Brian already answered your understanding as posted above seems correct.  Except in the case where there has been only a running query you will download an average time.  The problem with averages is that one or two unusual executions that can skew the average, but in most cases the average will be probably fairly accurate.

    - -

    HTH - Mark D Powell.

  • How to identify columns that have the same data in a SQL query or function?

    Deal all,

    How to identify columns that have the same data in a SQL query or function? I have the sample data as below

    DEPT_IDEMP_IDCome on
    !CITYSTATECOUNTRY111 June 1983DELHIHUMAN RESOURCESIndia1218 January 1987DELHIHUMAN RESOURCESIndia1328 November 1985DELHIHUMAN RESOURCESIndia144 June 1985DELHIHUMAN RESOURCESIndia255 June 1983MUMBAIHDIndia266 June 1983MUMBAIHDIndia277 June 1983MUMBAIHDIndia288 Jun. 1983MUMBAIHDIndia399. June 1983GURGAONDLIndia31010 June 1983GURGAONDLIndia

    Now, I want to Indify columns that have the same data for the same Department ID.

    Is it possible in sql unique or do I have to write the function for this? Pls Help how to write?

    Thanks in advance.

    You can try this?

    WITH T1)

    DEPT_ID, EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY

    ), ()

    SELECT 1, 1, TO_DATE('1.) June 1983', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 2, TO_DATE('18.) January 1987', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 3, TO_DATE('28.) November 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 4, TO_DATE('4.) June 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.5, TO_DATE('5.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.6, TO_DATE('6.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.7, TO_DATE('7.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.8, TO_DATE('8.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 3, 9, TO_DATE('9.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DUAL UNION ALL

    SELECT 3.10, TO_DATE('10.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DOUBLE)

    SELECT DEPT_ID,

    RTRIM (XMLAGG (XMLELEMENT(A,VALS||',')). Extract ('//Text ()'), ',') COLUMNS_WITH_DUPLICATE

    DE)

    SELECT * FROM)

    SELECT DEPT_ID,

    EMP_ID,

    Date of birth

    CITY,

    STATE,

    COUNTRY

    DE)

    SELECT DEPT_ID,

    EMP_ID,

    Date of birth

    CITY,

    STATE,

    COUNTRIES,

    COUNT (*) OVER(PARTITION BY DEPT_ID ORDER BY EMP_ID DESC,DOB DESC,CITY DESC,STATE DESC, COUNTRY DESC) RN

    DE)

    SELECT DEPT_ID,

    CASE WHEN(CEID>1) AND THEN 'YES' ELSE 'NO' END AS EMP_ID.

    CASE WHEN(CDOB>1) THEN 'YES' ELSE 'NO' END AS DATE OF BIRTH,

    CASE WHEN(CCITY>1) AND THEN 'YES' ELSE 'NO' END AS CITY.

    CASE WHEN(CSTATE>1) AND THEN 'YES' ELSE 'NO' END AS STATE.

    CASE WHEN(CCOUNTRY>1) THEN 'YES' ELSE 'NO' END AS A COUNTRY

    DE)

    SELECT DISTINCT

    DEPT_ID,

    CEID,

    CDOB,

    CITY,

    CSTATE,

    CCOUNTRY

    DE)

    SELECT DEPT_ID,

    COUNT (*) TO THE CEID (DEPT_ID PARTITION, EMP_ID),.

    COUNT (*) ON CDOB (DEPT_ID SCORE, DATE OF BIRTH),

    COUNT (*) ON THE CITY (DEPT_ID PARTITION, CITY),

    COUNT (*) ON CSTATE (DEPT_ID PARTITION, STATE).

    COUNT (*) ON CCOUNTRY (DEPT_ID, COUNTRY PARTITION)

    FROM T1)))

    WHERE RN = 1)

    UNPIVOT (CLO FOR (VALS) IN (EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY)))

    WHERE COLS = "YES".

    DEPT_ID GROUP;

    OUTPUT:

    DEPT_ID COLUMNS_WITH_DUPLICATE
    --------- ------------------------

    1 CITY, COUNTRY, STATE
    2 CITY, COUNTRY, STATE
    3 CITY, COUNTRY, STATE

    Post edited by: Parth272025

  • issue in the creation of the IOM group reactivate via sql query.

    Hi guys,.

    I am trying to create a group to IOM database through sql query:

    insert into ugp(ugp_key,ugp_name,ugp_create,ugp_update,ugp_createby,ugp_updateby,) values(786,'dbrole','09-jul-12','09-jul-12',1,1);

    It is the inclusion of the group in the table of the PMU, but he does not appear in the administration console.

    After that, I also tried with this query:

    insert into gpp(ugp_key,gpp_ugp_key,gpp_write,gpp_delete,gpp_create,gpp_createby,gpp_update,gpp_updateby) values (786,1,1,1,'09-jul-12',1,'09-jul-12',1);

    After I haven't tried with this query.but still no use.

    and I also tried to assign a user to the group through query:

    insert into usg(ugp_key,usr_key,usg_priority,usg_create,usg_update,usg_createby,usg_updateby) values (4,81,1,'09-jul-12','09-jul-12',1,1);

    But always the same problem.it is the insertion in db.but do not enter in the administration console.

    Thank you
    Hanuman.

    Muriel Hanuman says:
    Thanks guys.the above queries are successfully.just to work I rebooted the server.

    I certify here if we want to add the group to 10g through sql query, then insert the records in the tables 'PMU' and 'MPP '.

    11 g, need to add records from the ugp only table. Because the administrator has also not found in this table only.so no need to table gpp.

    Thank you
    Hanuman.T

    1 groups are stored in the table of the PMU to IOM 11.1.1.5. The table of the GPP is present, but not used in 11.1.1.3 and is totally deleted schema repo in 11.1.1.5
    2. as far as I know, there is no other vital records except that in UGP table objects are created for a group, you are, in theory, able to create groups with direct SQL. Using the API of the IOM is the preferred method.
    3. you must use the sequence UGP_SEQ to get a new key for a group that you create.

    Vladimir

  • ViewStack container. Choose the view based on the variable command.

    Hi I am trying to implement in my application role-based access control.  I opted for a login screen which will compare users and passwords to a MySQL database.  on a match, I need to read the 'role' associated with each user.  I want to have different views for each Admin role with the role, that role will see views admin and users, a user discovers and so on.

    I managed with a button to change the view.selectedChild.  How can I use view.selectedChild = $var.

    As a test I used a dataGrid to give me choices.  But when I use the selectionChange like this event handler

    protected function dataGrid_selectionChangeHandler(event:GridSelectionEvent):void
                                  {
                                            view.selectedChild = dataGrid.selectedItem.role;
                                  }
    

    It does not change the view.

    Is it possible to use ViewStack for control of access in this way?

    SelectedChild is a point of view.  What is the role?  What is an int or a string?  I would like to map it to selectedIndex instead.

    But really, I wouldn't use ViewStack and use view States that match name role.

  • How to find the views created on a table... ?

    Hi all

    I have a table name, EMP. I want to know what are the views created on this table. Is there any SQL query is there for this or any other
    How to find.

    Thanks in advance.
    PAL

    You can use ALL_DEPENDENCIES to this:

    SQL> create view emp_v as select * from emp;
    
    View created.
    
    SQL> select name
      2  ,      referenced_name
      3  ,      referenced_type
      4  from   all_dependencies
      5  where  name = 'EMP_V';
    
    NAME                           REFERENCED_NAME                                                  REFERENCED_TYPE
    ------------------------------ ---------------------------------------------------------------- ----
    EMP_V                          EMP                                                              TABLE
    
    1 row selected.
    
    SQL> select name
      2  ,      referenced_name
      3  ,      referenced_type
      4  from   all_dependencies
      5  where referenced_name = 'EMP';
    
    NAME                           REFERENCED_NAME                                                  REFERENCED_TYPE
    ------------------------------ ---------------------------------------------------------------- ----
    EMP_V                          EMP                                                              TABLE
    EMP_TRG                        EMP                                                              TABLE
    
    2 rows selected.
    
    SQL> 
    

    Remember it's important if you limit the NAME or REFERENCED_NAME.
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14237/statviews_1041.htm#sthref935

    Edit

    Ah, Gave!
    If you don't want to teach him something and become independent?

    Now you made me feel guilty ;) (don't know what that Johan position initially, but anyway...)
    I blame my currently terribly slow connection for this...

    Anyway, OP, always start a quick search of the documentation first.
    Chances are that you will find you your answer.
    Houses:
    http://www.Oracle.com/pls/db102/homepage
    http://www.Oracle.com/pls/db112/homepage

    Published by: hoek on 15 October 2010 14:53

  • Find the view table_name

    Hello

    I'm stuck at some point:

    Working on a form in oracle 11i GL, I picked up the name from the view of historical record.

    I have access to the sql instance and want to know how to find the table_name/s for the related view.
    For example. I have a display name: GL_SETS_OF_BOOKS_V, how can I find using sql commands, the table name for this point of view?

    Thanks in advance
    Shanks

    Shanks,

    You can use the following or you can see the query from the view to discover the names of the tables used in the query

     select * from user_dependencies
    where type='VIEW'
    and name='NAME OF YOUR VIEW';
    
    or
    
    select name, referenced_name from user_dependencies
    where type='VIEW';
    

    Concerning

    Published by: OrionNet on March 4, 2009 12:37 AM

  • Find the device based on serial number

    Hi all

    I got a spot on place to locate the Cisco gear in our (hundreds of them), got the serial number but wonder if there is a smart way to find out where is this piece? rather than 'show version' on each device, then look for the serial number. Please teach me. Thank you very much.

    Hi Duke,

    Thank you for using the Cisco Small Business forums. My name is Cristian, I'm a developer of electronic content, and I'm part of the small community of business support.

    Unfortunately, I don't know of a method where you can directly find the device via the serial number. However, I know that Cisco's FindIT uses the CDP of Cisco protocol to detect Cisco devices in a network. You could hover over with the mouse device names and the serial number will be displayed.

    I hope that this response will be useful, and I hope that you respond with questions or concerns.

    * Please answer question mark or note the fact other users can benefit from the TI *.

    Kind regards

    Cristian Gonzalez

    EContent Cisco Developer

  • How to find the definition of an indextype sql

    Hi all

    I would like to know how to find the "indextype" sql definition...?

    could not understand this. I even tried sql developer and TOAD to extract the sql definition but couldn't!

    Thanks in advance.

    Hello

    You can use the dbms_metadata.getddl

    the query would be like this:

    Select dbms_metadata.get_ddl ('INDEXTYPE', 'indextype_name') of double;

    How to recover or retrieve oracle database operator. Master of geodata

    Kind regards

  • Eliminate the duplicate based on the condtion in Select of SQL query.

    Hi all

    I write the SQL query where I have to select values based on the condition in the column.

    Lets say I have 3 columns position, description, used, there are different values in the position but for some positions of the column description of the lines is the same and if column Description is the same and employee is null then that there should be only one row returned and if the description is the same but the employee column is not null then it should be several lines.

    I can't use Group by that we have around 35 columns in the select query.

    Please suggest any Solution.

    Hi Michael,

    I adds a column to the t2 to get the good understanding of my needs.

    Level
    Employee From Date to_date
    1 Test2 21.03.2014 21.04.2014
    2 Test4 21.02.2014 20.03.2014
    2 Test1 21.03.2014 21.04.2014
    2 Test3 21.04.2014
    3 MgrTest 21.03.2014

    Now, the result should look like this.

    Level
    Employee From Date TO Date
    1 Test2 21.03.2014 21.04.2014
    2 Test3 21.04.2014
    2 Test1 21.03.2014 21.04.2014
    3 Mgrtes 21.03.2014
    4

    There was an addition more as if this day is not null for the given level, then the query must return a single line of balnk more with the same position, I am reached using any Union and works very well I'm stuck with the point above.

  • How to find the third element table pl/sql ina

    Hello friends,

    I have a pl/sql table of NUMERIC type, where am store all salaries of employees.

    I want to find the third bigger payday by browsing through the pl/sql table.

    Pls advice.

    Thank you/kumar
    DECLARE
        TYPE max_earnings_type IS TABLE OF NUMBER;
        TYPE max_earnings_sorted_type IS TABLE OF NUMBER
          INDEX BY BINARY_INTEGER;
        max_earnings_tab        max_earnings_type;
        max_earnings_tab_sorted max_earnings_sorted_type;
        m number;
    BEGIN
        SELECT  sal + comm
          BULK COLLECT
          INTO  max_earnings_tab
          FROM  emp;
        FOR v_i in 1..max_earnings_tab.count LOOP
          IF max_earnings_tab(v_i) IS NOT NULL
            THEN
              max_earnings_tab_sorted(max_earnings_tab(v_i)) := 1;
          END IF;
        END LOOP;
        m := max_earnings_tab_sorted.last;
        DBMS_OUTPUT.PUT_LINE('MAX value in PL/SQL table is ' || nvl(to_char(m),'NULL'));
        m := max_earnings_tab_sorted.prior(m);
        DBMS_OUTPUT.PUT_LINE('Second MAX value in PL/SQL table is ' || nvl(to_char(m),'NULL'));
        m := max_earnings_tab_sorted.prior(m);
        DBMS_OUTPUT.PUT_LINE('Third MAX value in PL/SQL table is ' || nvl(to_char(m),'NULL'));
    END;
    /
    MAX value in PL/SQL table is 2650
    Second MAX value in PL/SQL table is 1900
    Third MAX value in PL/SQL table is 1750
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • How to find the foreign key in pl/sql

    Error from the 1 in the command line:
    DELETE FROM ZKET_SOLE WHERE IID_SOLA = 1
    Error report:
    SQL error: ORA-02292: integrity constraint (IRCKIS. ZKETSTIP_ZKET_FK) violated - book of the foundling
    02292 00000 - 'constraint integrity (s.%s) violated - child notebook found. '
    * Cause: attempted to remove a parent key value that was a stranger
    dependence.
    * Action: remove dependencies first then the parent or disable the constraint.


    I need to find the foreign key, but I don't know how. I know it must be in the dictionary, but I'm not. I don't have access to the ER model.

    THX

    Run this query:

    select * from dba_constraints where owner = 'IRCKIS' and constraint_name = 'ZKETSTIP_ZKET_FK'
    
  • How can I show all the results returned by a sql query?

    Hi guys,.

    I need your help.
    Let's say I have a table: TableA. Fields in TableA are aleg, anon, monkeys. The following sentence can return, in general, several rows: select anon from TableA where aleg = somevalue. I would like to show the result of the anon column but no luck. If I try to display the results in a TextArea and the origin is a sql query shows that the first value of the line. I tried to see the like: display text (based in PLSQL) and a block anonymous plsql and coding
    DECLARE
    v_anon TableA.anon%TYPE;
    CURSOR v_cur IS
    Select anon from TableA where aleg = somevalue;
    BEGIN
    OPEN v_cur.
    LOOP
    SEEK v_cur INTO v_anon;
    EXIT WHEN v_cur % NOTFOUND;
    : FIELD_IN_FORM: = v_anon;
    END LOOP;
    CLOSE V_cur;
    END;
    but in this case, he showed no results.
    So the first question is what type of field can I use to show the result. And the second is what can I do to be able to show all the results returned by the query (if more than one line).

    concerning

    GMC

    We are all happy that you found a solution, but you must sign your messages and change your ID forum. It is always good to know the real name of the person you are communicating with. In addition, if you plan to get answer to your questions in the future, you must mark responses as useful or correct if they helped you solve your problems.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for