Dynamic SQL statement to select the tables which are updated today...

Hi Guys,
I need to find the names of all the tables which contain rows that are inserted/updated in a given time stamp...
Below statement gives me the list of all the tables in the database...
select t.table_name from all_tables t;All these tables in the database have a column called rowversion which gives the updated/inserted date of a record. I need to write a select statement (probably dynamic) which will give me the table names which contain the rowversion value 24-01-2013....
Any help is very much appreciated...

Napster wrote:
Hi Karthick,
Thanks for your reply...
But when I execute your select statement I am getting an error saying table SYS.DBMS_XMLGEN does not exist.
Probably something wrong in my environment?Yes you can, here is a quick untested code
declare
  my_filter date := to_date('24-01-2013', 'dd-mm-yyyy');
  my_count integer;
begin
  for i in (select table_name from user_tables)
  loop
     execute immediate q'[select count(*) from ]' || i.table_name || q'[ where rowversion = :1]'
     using my_filter
     into my_count;
     if my_count > 0 then
         dbms_output.put_line(i.table_name);
     end if;
  end loop;
end; 
/

Similar Messages

  • How to find the tables which are the candidates for gathering stats in 10g

    Hi,
    In 10g how can we find the tables, partitions which are the candidates for gathering the stats.
    I want to findo those tables, partitions and gather the stats on daily basis.
    Thanks,
    Mahi

    The probem you describe has been posted about before. There are known issues with the default dbms_stats parameter settings for some environements.
    What you can do is just go ahead an manually submit dbms_stats commands with appropriate parameters for tables that have not been analyzed or modify the maintenance window to give it more time.
    I would rather just generate the missing statistics myself then the job can continue to run in the normal maintenance window. Since the job should be looking only for tables that meet the stale requirements then once everything is analyzed it is likely the job can keep the statistics updated in the default time allowed.
    Be warned that the default parameter settings do not work well for some tables in some environments and if that proves true for your shop you can generate workable statistics on a table and then lock them so the nightly job ships regenerating the statistics for that table. You would then manually unlock, generate, and lock that statistics for that table as necessary.
    HTH -- Mark D Powell --

  • How to see the tables which are in the physical layer of SampleAppLite rpd

    Hi Everyone,
    I am new to OBIEE and I installed OBI Apps with Oracle 11g in my laptop. I tried to create reports using the OracleBIAnalyticsApps rpd. How can I know from which schema the tables are coming in the physical layer of the repository so that I can create a connection pool to the database. I got the default SampleAppLite rpd when I install the OBIEE but I am unable to see those tables in the database schema which are used in the SampleAppLite physical layer. Can anyone tell me how can I see the tables in the database which I see in the rpd. Actually my question may be wrong as I am new to this field, so please let me know if this is a wrong question. As I unable to express my question correctly. Thanks.

    For the OracleBIAnalyticsApps rpd - the tables are under "Catalog" then "dbo" in database "Oracle Data Warehouse" in the physical layer. The RPD comes out of the box with the required connection pools - you dont need to create any. The connection pools "Oracle Data Warehouse Repository Initblocks Connection Pool" and "Oracle Data Warehouse Connection Pool" in "Oracle Data Warehouse" read the data from the business analytics warehouse that you created in a schema name of your choosing with the DAC. All you need to do is edit the user name and password and the data source name with a connect string - which is the local net service name to your database for default call interface OCI 10g/11g assuming you used an Oracle database for your warehouse. One way to test the connection pool is to right click any table/alias then "Update Row Count".
    BTW Using the Admin Tool open the OracleBIAnalyticsApps rpd then do "Tools" then "Utilities" then "Repository Documentation" then "Execute". This will create a spreadsheet showing you all the mappings from the presentation to business to physical layers.

  • [Urgent] List the tables which are in a mapping using OMB ?

    Hello,
    Does anyone know how I can list the table names which are contained in a mapping by using the OMB language ?
    After with this list I'll retrieve the properties of the extraction and loading hints (by using the OMBRETRIEVE command).
    Thanks in advance for your help !
    Regards,
    Florent

    Hi Florent
    Something like the following will retrieve the table operators in a map:
    set table_ops [OMBRETRIEVE MAPPING '$mapname' GET TABLE OPERATORS]
    As an example of navigating the map using OMB the tcl below will traverse the map (change the mapname variable and run in the context of the module containing the map) - the results are written to a textfile in /tmp/map.txt. You can see how the operators are navigated and the connections queried, each operator is listed and the connected operators.
    Cheers
    David
    set mapname EXAMPLE_17_21
    set ops [OMBRETRIEVE MAPPING '$mapname' GET OPERATORS]
    set fid [open "/tmp/map.txt" "w"]
    foreach op $ops {
    puts $fid ""
    puts $fid "Operator: $op"
    puts $fid "------------------------------------------------"
    foreach top $ops {
    set connected [OMBRETRIEVE MAPPING '$mapname' HAS CONNECTION FROM OPERATOR '$op' TO OPERATOR '$top']
    if {$connected == 1} {
    puts $fid " $op -> $top"
    set grps [OMBRETRIEVE MAPPING '$mapname' OPERATOR '$op' GET GROUPS CONNECTED TO OPERATOR '$top']
    puts $fid " Attribute Mappings"
    puts $fid " ------------------"
    set tgrps [OMBRETRIEVE MAPPING '$mapname' OPERATOR '$top' GET GROUPS]
    foreach grp $grps {
    set atts [OMBRETRIEVE MAPPING '$mapname' OPERATOR '$op' GROUP '$grp' GET ATTRIBUTES]
    foreach att $atts {
    foreach tgrp $tgrps {
    set tatts [OMBRETRIEVE MAPPING '$mapname' OPERATOR '$top' GROUP '$tgrp' GET ATTRIBUTES CONNECTED FROM ATTRIBUTE '$att' OF GROUP '$grp' OF OPERATOR '$op']
    foreach tatt $tatts {
    puts $fid " $grp.$att -> $tgrp.$tatt"
    close $fid

  • Urgent-How to find the tables which are used in  DB02 transaction

    Hi,
    Can anybody help me in finding the tables  in Tablespaces tabstrip & Tables n Indexes tabstrip  in DB02 transaction??

    Hi,
    open the following link.
    http://books.google.co.in/books?id=jTTrZjucb_QC&pg=PA37&lpg=PA37&dq=dbo2%2Bsap&source=web&ots=FgA9pC3u24&sig=sOG3EJRm5HGW2aFpkVVH_oxBjjo&hl=en#PPP1,M1
    Master data load failure
    Reward if Helpful
    Jagadish

  • Concatenate problem for Dynamic SQL statements

    Hi Experts ,
    I am building Dynamic SQL statements depending on the values which the user enters into the select option parameters .This dynamic query is passed to cl_sql_connection object for querying from another databasse
    So i wrote dynamic values for one select option spointof for the database field ppointofdelivery.
    loop at spointof.
    CONCATENATE ' pointofdelivery between ''' spointof-low''''
    ' AND ''' spointof-high''''
    INTO where_clause .
    endloop.
    The whereclause has value pointofdelivery between '123' and '124'.(if the user has entered 123 and 124 as values)
    This works fine . But my problem is I have to pass the fieldnames and operator dynamically into where_clause depending on User input.
    when i am writing code like the below
    field_name = ' pointofdelivery '.
    operator = '='.
    CONCATENATE field_name operator '''spointof-low''' INTO where_clause .
    the where_clause contains value
    pointofdelivery = ' spointof-low '
    and not pointofdelivery = ' 123 ' as expected .
    Do you know why this is haapening as it is not taking the value.
    Thanks
    Arshad

    Hi,
    there are lot of function modules..available...to build a where clause based on the select-options..
    check the FM FREE_SELECTIONS_RANGE_2_WHERE
    Thanks
    Naren

  • Sql statement for retrieving the last update time of a table

    Hello all,
    Can somebody give me an example of sql statement for retrieving the last update time of an oracle table.
    Thank you
    Il

    Thanks for the fast replies. It works great when I test it as a sql statement but when trying to populate a datalist with it it raises the following exception:
    Exception Details: System.ArgumentException: SCN_TO_TIMESTAMP(MAX(ORA_ROWSCN is neither a DataColumn nor a DataRelation for table DefaultView
    Part of the Datalist Code:
    ItemTemplate>
    Line 12:             SCN_TO_TIMESTAMP(MAX(ORA_ROWSCN)):
    Line 13:             <asp:Label ID="SCN_TO_TIMESTAMP_MAX_ORA_ROWSCN__Label" runat="server" Text='<%# Eval("[SCN_TO_TIMESTAMP(MAX(ORA_ROWSCN))]") %>'>
    Line 14:             </asp:Label><br/>
    Line 15:             <br/>
    {code}
    Why is this happening? Any ideas?
    Il                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help With SUBSTR in dynamic SQL statement

    Following is the dynamic SQL statement.
    EXECUTE IMMEDIATE 'UPDATE table_name pml
    SET pml.'|| con_fields.field ||' = SUBSTR(pml.'||con_fields.field||' ||'' ''||
    (SELECT pml1.'||con_fields.field||'
    FROM table_name pml1
    WHERE pml1.grp_id = '||los_concats.grp_id ||'
    AND pml1.row_id = '||los_concats.row_id||'
    AND pml1.loser_flg = ''Y''),1, '||con_fields.max_length||')
    WHERE pml.grp_id = '||los_concats.grp_id ||'
    AND pml.loser_flg IS NULL ';
    what it does is that it updates a particular field. This field is concatenated by a field of a similar record.
    My problem is with SUBSTR function. Since I am concatenating fields I do not want the field to be updated greater than max_length on that field, the reason why I use SUBSTR. the select query inside SUBSTR works alright with one of the AND condition in a WHERE clause not present. When I add that additional condition it gives me this error.
    ORA-00907: missing right parenthesis.
    Is there any way to get around this problem. Does SQL has other than SUBSTR function which can limit the character length.
    Appreciate it.

    The other alternative I thought about was to do this first
    EXECUTE IMMEDIATE 'SELECT pml.'||con_fields.field||'
    FROM table_name pml
    WHERE pml.grp_id = '||los_concats.grp_id||'
    AND pml.row_id = '||los_concats.row_id||'
    AND pml.loser_flg = ''Y''
    ' INTO v_concat_field;
    write into the variable v_concat_field and then use it into the previous script.
    But on this I get SQL Command not properly terminated, I don't get it Why?
    Donald I tried with your suggested script. It works fine with one of the conditions eliminated. I don't understand what the error trying to say?
    Thanks

  • Dynamic SQL statements

    Hi
    Here is an interesting question for all. My application has to support 5 markets. For that I created a report based on querying a view. That report is based on some search criteria which comes through a form. Right now the report is perfectly working as I have queried it as
    select * from portland.rsu_inventory where ne = :ne_no
    But we have some more markets apart from PORTLAND. For that we want to use the same application. So we have to be able to pass the market name dynamically. I am able to capture the market name in the search croteria form. But how can I send the market name to the Report SQL statement like
    select * from &#0124; &#0124;MarketName&#0124; &#0124;.rsu_inventory where ne = :ne_no
    Here the "MarketName" should be the market name that I would dynamically pass.
    How can I acieve this. Thanks for any kind of suggession.
    venu

    According to the metalink, the new version of OracleAs Portal is no longer support the query statement passing to this wwv_render_report.show procedure but however you can pass the cursor handle to this procedure instead. Here is the sample code to call this procedure:
    declare
    v_qry_stmt varchar2(32767) ;
    v_cur_hdl int;
    begin
    v_cur_hdl := dbms_sql.open_cursor; -- open cursor
    v_qry_stmt := '<your query>';
    --Example query:
    --v_qry_stmt := 'select empno,ename from scott.emp';
    dbms_sql.parse(v_cur_hdl, v_qry_stmt, dbms_sql.native);
    PORTAL30.wwv_render_report.show(p_table_border=>'1',
    p_heading_bgcolor=>'#FFFFF0',
    p_heading_font_face=>'Arial',
    p_heading_font_size=>'13',
    p_table_bgcolor=>'#FFFFFF',
    p_font_face=>'Arial',
    p_font_size=>'10',
    p_query=>to_char(v_cur_hdl),
    p_col_headings=>PORTAL30.wwv_standard_util.string_to_table2('Employee Number:Employee Name')
    end;
    Thanks
    -Krishnamurthy

  • Build dynamic query depending upon selection of table and columns

    Hi ,
    I want your views on following requirement :
    we r doing generic export to excel functionality .
    1.User will select multiple tables and according to tables ,columns on that table will select
    2.There can be multiple table
    3.depending upon column and table selection , we have to build dynamic query and execute .
    Please let me know is it possible .If yes then please tell me how to do above requirement.
    Thanks in advance

    Hi,
    Identifiers cannot be used as bind variables, query are parsed
    before evaluate bind variables. Identifiers like table name.
    For excel you can use some like this:
    SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
    SPOOL test_xls.xls
    SELECT colum1||chr(9)||columN FROM tableName;
    or CSV:
    SELECT colum1|| ',' ||columN FROM tableName;
    SPOOL OFF
    SET MARKUP HTML OFF ENTMAP OFF SPOOL OFF PREFORMAT ON
    For construct the query i suggest to read "Dynamic SQL Statements":
    http://www.java2s.com/Tutorial/Oracle/0440__PL-SQL-Statements/0300__Dynamic-SQL.htm
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/dynamic.htm
    http://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adg09dyn.htm
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:227413938857
    --sgc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • DB Tool List Table: How to access tables which are in different SQL database ?

    Hi, All,
    I'm working on a database application (SQL server) and is evaluating the NI DB Tool kit for this project.
    One of the requirement is that I need to access tables which are in two different database
    (say Table A in DB 1 and Table B in DB 2).
    Our IT guys has linked Table A in DB1 to DB 2 and I verfied this when I use the SQL server managment studio.
    When DB 2 tables are populated, Table A from DB1 is also there. I can also do the same thing using MS Access.
    Table A in DB1 is avalaible to me enven though I only connect to DB 2.
    Here comes the problem.
    When I use DB Tool List Table.vi to access DB2, it does NOT list Table A in DB1. It only list the tables in
    the database (DB2) which I make connection to (using DB Tool Open Connection.vi with a file DSN)
    So my work around right now is to open two seperate connection to DB1 and DB2. However, this approach
    obviously creates a problem when I have to access seperate database constantly in my application.
    What would be a solution to this ? I've search the forum but only see one post that's somewhat related to
    my question. (And it was posted on 2004) Perhaps I need to alter the code in the orignial VI (DB Tool List Table.vi)??
    My IT guy told me he has not encountered this scenario since he writes codes in other enviroment such as
    VB and others, and he's always been successful by linking tables to different database. 
    I hope my question is sound and clear since I really don't know much about database terminology.
    Any comment/suggestion is much appreciated !!!
    Thanks
    Chad
    Solved!
    Go to Solution.

    To josborne:
    To answer your question:
    - Are the two databases contained on the same SQL Server instance? 
    Or are the databases on separate instances?  I assume they are on
    separate servers, otherwise this wouldn't really be an issue.  But its
    good to know because it will affect how you build your SQL statements.
    Yes they are on separate instances. 
    - Ask your IT people specifically how they "linked Table A in DB1 to
    DB 2".  I assume they used "linked servers". 
    Maybe I used the wrong terminology "linked." They created a "View of Table A (DB1)" in DB2 using the management studio.
    Here is a screen shot of that. As you can see, dbo.VISUAL_WORK_ORDER is seen under LABVIEW database in the management studio.
    I also see the same table when I make connection to database using MS Access.
    Could you elaborate on "configure your SQL statement correctly" =) ? The purpose of using LabView's took kit is so that I can do
    minimum SQL statements. Are you talking about modifying LabView's native VI (DB Tool List Table.vi) ?
    Thanks for the information. SQL is just something new to me.

  • How can i find the tables which dont contain any data under my database ?

    Can you please suggest me a way to find the tables which dont contain any data under my database ?
    Regards,
    Renu

    Can you please suggest me a way to find the tables which dont contain any data under my database ?
    For the schema that you've logged in to, you could do something like this:
    test@XE>
    test@XE> @test
    test@XE> --
    test@XE> set serveroutput on size 1000000
    test@XE>
    test@XE> declare
      2    n_count  number;
      3  begin
      4    for rec in (select object_name from user_objects
      5                where object_type = 'TABLE')
      6    loop
      7      execute immediate 'select count(*) from '||rec.object_name
      8      into n_count;
      9      if (n_count = 0) then
    10        dbms_output.put_line(rec.object_name);
    11      end if;
    12    end loop;
    13  end;
    14  /
    BONUS
    RUN_STATS
    PL/SQL procedure successfully completed.
    test@XE>
    test@XE>For the other schemas, you could query from dba_objects and probably display the owner as well.
    HTH
    isotope

  • How can I open a cursor for dynamic sql statement

    Hi,
    I'm facing issues opening a cursor for dynamic sql statement : PLS-00455: cursor 'RESULT1' cannot be used in dynamic SQL OPEN statement.
    CREATE OR REPLACE FUNCTION DEMO
    (MN_I in VARCHAR)
    return AB_OWNER.ABC_Type.NonCurTyp is
    RESULT1 AB_OWNER.ABC_Type.NonCurTyp;
    sql_stmt VARCHAR2(4000);
    BEGIN
    sql_stmt := 'SELECT * FROM AB_OWNER.DUN WHERE JZ_I in ('||mn_i||') ORDER BY app.ACC_I';
    OPEN RESULT1 FOR sql_stmt;
    END IF;
    return RESULT1;
    END DEMO;
    What changes should I make in the code so that it doesn't fail? I can't change the definition of RESULT1 cursor though.

    Gangadhar Reddy wrote:
    I used SYS REFCURSOR and was able to implement successfully.How many times did you run this successful implementation that does not use bind variables?
    Because this is what will happen when it runs a lot.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17766/e2100.htm#sthref1874
    http://forums.oracle.com/forums/search.jspa?q=%2BORA-04031%20%2Bbind&objID=c84&dateRange=all&rankBy=10001&start=30
    And you will have to regularly restart the server, or possibly slightly less invasive, flush the shared pool.
    Flushing Shared Pool regularly
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1516005546092
    >
    Ok, this is an easy one to diagnose.
    You are not using bind variables. This is terrible. Flushing the shared pool is a bad
    solution -- you are literally killing the performance on your box by not using them.
    If I was to write a book on how to build “non scalable applications in Oracle”, this
    would be the first and last chapter. This is a major cause of performance issues and a
    major inhibitor of scalability in Oracle. The way the Oracle shared pool (a very
    important shared memory data structure) operates is predicated on developers using bind
    variables. If you want to make Oracle run slowly, even grind to a total halt – just
    refuse to use them.
    >
    But, please feel free to go ahead with this successful implementation.
    I just hope anyone else who reads this doesn't make the same mistake.

  • Neea a sql query for inverting the table

    Hi,
    I am facing the problem in forming a SQL statement in oracle 10g
    Table structure:
    user field1 field2 field3 field4 field5 field6 .......
    one 11 12 13 14 15 16
    two 21 22 23 24 25 26
    three 31 32 33 34 35 36
    i want a SQL query where the out put is
    field1 11 21 31
    field2 12 22 32
    field3 13 23 33
    field4 14 24 34
    Regards,
    Balu CH

    check this Forums page
    <http://forums.oracle.com/forums/search.jspa?threadID=&q=Rows+to+Columns&objID=f75&dateRange=last90days&userID=&numResults=15>
    will help u.
    Rgds
    Sudar

  • Count the rows which are selected ?

    Hi Experts,
    I need help.My requirement is:
    I am having a table which can be multiple selected. But there are two buttons attached to it.Edit and Delete.For Delete I want the Multiple Selection not for EDit.So, If i will click the Edit after multiple selection of the rows.How i can give pop-up that multiple edit is not possible?Means I want to count the rows which are selected how to do that?
    Please guide me.
    Urgent need
    Regards
    Nutan

    Hi Nutan,
    Marcel is right about backend. However I might have an idea once I am developing a quiet similar solution. I would like to ask you to explain with more detail. It seems you have two requirements in one question.
    Regards,
    Gilson

Maybe you are looking for

  • Itunes 9.1 wont start, says itunes has stopped working

    I have a windows vista home premium 32 bit gateway laptop/pc, with a wired connection for internet. I have had no trouble for 3 years with past itunes but now with 9.0 and 9.1 it simply just wont start at all. When I double click on itunes I get, "it

  • New Condition table / access not getting picked in purchase order.

    I have created a new condition table for the tax to be calculated for Site / Material combination. The access sequence is also crated. When I created the purchase order the condition / tax is not getting picked. When I checked in the analysis, I foun

  • Find the itemRenderer components in Datagrid

    Hi, I have defined my itemRenderer for a DataGrid with different components like Checkbox, button etc according to the input. I would like to access the components from the application like dg.chkbox. Is it possible to do that?? Thanks in advance...

  • 11.03 850 outbound to 11i

    We have a process that outputs an 850 flat file to a VAN called Neoforma. I am looking for anyone that can possibly identify the steps to move that process inot 11i w/o much fuss. How long should I plan for this conversion???

  • DocumentClient query with Int64 where clause is incorrect when converted and sent to Azure

    The code below constructs a query with a lambda expression involving an Int64. When the query is converted and sent to Azure, it is incorrect. I captured the request to Azure using Fiddler for the example below, and the body contained: {"query":"SELE