Check the old sql statements


Hi, I want to know what updates occur during the night, so I can run it through a plan to explain and try to tune them (11.2). I have not any audit

Ive looked in v$ _sql_plan, but can't make much sense of it. Is there an easy way to find out what went?

Thank you very much

Adam

885842 wrote:

Hi, I want to know what updates occur during the night, so I can run it through a plan to explain and try to tune them (11.2). I have not any audit

Ive looked in v$ _sql_plan, but can't make much sense of it. Is there an easy way to find out what went?

Thank you very much

Adam

REDO contains any DML history.

Dbms_logmnr can provide details for any & all the UPDATE instructions

Tags: Database

Similar Questions

  • Run the second sql statement only if the first sql statement is set to zero.

    Hey guys I seem to have a mental block here. I have two sql statements. I would like to than the second to run only if the first sql statement is set to zero. I know that I can use PLsql but I would really like to see if I can do this with sql upward. Your answers are very much appreciated.
    This is the first sql
      Select     ft.fund_code, 
                 ft.orgn_code, 
                 ft.acct_code, 
                 ft.amount, 
                 fb.owner_pidm, 
                 ft.prog_code      
          from ftrbremb fb , ftcractg ft
          where fb.doc_code = 'TR000038'
          and fb.ftpbport_id = ft.ftpbport_id
    second sql statement
         Select ft.fund_code, 
                 ft.orgn_code, 
                 ft.acct_code, 
                 ft.amount, 
                 fb.owner_pidm, 
                 ft.prog_code      
          from ftrbremb fb , ftcractg ft, ftprexps fx
          where fb.doc_code = 'TR000038'
          --and fb.ftpbport_id = ft.ftpbport_id
          and fx.ftrbremb_id = fb.id
          and ft.ftprexps_id = fx.id;
    How can I combine these two statements together so that when the first is null the second run. As a bonus, I want to get just the first line as well.
    Any help would be greatly appreciated. I tried to accomplish with the case statement but it dosent everything seems to work for me.
    Thank you

    Miguel,

    the idea is simple: join the two queries (via the union of all) and to change the second part as to return only the rows if the first query returns no rows by changing the NOT EXISTS (first request). Hope I made it clear... ;)

  • Custom on-the-fly SQL statement

    Is it possible to build the dynamic SQL statement in the DB adapter on the fly?

    You can do bulk collect and return the collection of pl/sql procedure.

    Prasanna-

  • Plans of multiple executions for the same SQL statement

    Dear experts,

    awrsqrpt. SQL shows several plans for a single SQL statement executions. How is it possible that a single SQL statement will be several Plans of executions within the AWR report.

    Here is the output of the awrsqrpt for your reference.

    WORKLOAD REPOSITORY SQL Report
    
    Snapshot Period Summary
    
    DB Name         DB Id    Instance     Inst Num Release     RAC Host
    ------------ ----------- ------------ -------- ----------- --- ------------
    TESTDB          2157605839 TESTDB1               1 10.2.0.3.0  YES testhost1
    
                  Snap Id      Snap Time      Sessions Curs/Sess
                --------- ------------------- -------- ---------
    Begin Snap:     32541 11-Oct-08 21:00:13       248     141.1
      End Snap:     32542 11-Oct-08 21:15:06       245     143.4
       Elapsed:               14.88 (mins)
       DB Time:               12.18 (mins)
    
    SQL Summary                            DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    
                    Elapsed
       SQL Id      Time (ms)
    ------------- ----------
    51szt7b736bmg     25,131
    Module: SQL*Plus
    UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
    0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
     TEST_BATCH_DT = (:B1 )
    
              -------------------------------------------------------------
    
    SQL ID: 51szt7b736bmg                  DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> 1st Capture and Last Capture Snap IDs
       refer to Snapshot IDs witin the snapshot range
    -> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
    
        Plan Hash           Total Elapsed                 1st Capture   Last Capture
    #   Value                    Time(ms)    Executions       Snap ID        Snap ID
    --- ---------------- ---------------- ------------- ------------- --------------
    1   2960830398                 25,131             1         32542          32542
    2   3834848140                      0             0         32542          32542
              -------------------------------------------------------------
    
    
    Plan 1(PHV: 2960830398)
    -----------------------
    
    Plan Statistics                        DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
    
    Stat Name                                Statement   Per Execution % Snap
    ---------------------------------------- ---------- -------------- -------
    Elapsed Time (ms)                            25,131       25,130.7     3.4
    CPU Time (ms)                                23,270       23,270.2     3.9
    Executions                                        1            N/A     N/A
    Buffer Gets                               2,626,166    2,626,166.0    14.6
    Disk Reads                                      305          305.0     0.3
    Parse Calls                                       1            1.0     0.0
    Rows                                        371,735      371,735.0     N/A
    User I/O Wait Time (ms)                         564            N/A     N/A
    Cluster Wait Time (ms)                            0            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        0            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     2            N/A     N/A
    Sharable Mem(KB)                                 26            N/A     N/A
              -------------------------------------------------------------
    
    Execution Plan
    ------------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT             |                 |       |       |  1110 (100)|          |
    |   1 |  UPDATE                      | TEST            |       |       |            |          |
    |   2 |   TABLE ACCESS FULL          | TEST            |   116K|  2740K|  1110   (2)| 00:00:14 |
    |   3 |   TABLE ACCESS BY INDEX ROWID| ACCT            |     1 |    26 |     5   (0)| 00:00:01 |
    |   4 |    INDEX RANGE SCAN          | ACCT_DT_ACC_IDX |     1 |       |     4   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------------------
    
    
    
    
    Plan 2(PHV: 3834848140)
    -----------------------
    
    Plan Statistics                        DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
    
    Stat Name                                Statement   Per Execution % Snap
    ---------------------------------------- ---------- -------------- -------
    Elapsed Time (ms)                                 0            N/A     0.0
    CPU Time (ms)                                     0            N/A     0.0
    Executions                                        0            N/A     N/A
    Buffer Gets                                       0            N/A     0.0
    Disk Reads                                        0            N/A     0.0
    Parse Calls                                       0            N/A     0.0
    Rows                                              0            N/A     N/A
    User I/O Wait Time (ms)                           0            N/A     N/A
    Cluster Wait Time (ms)                            0            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        0            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     2            N/A     N/A
    Sharable Mem(KB)                                 26            N/A     N/A
              -------------------------------------------------------------
    
    Execution Plan
    ---------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT             |              |       |       |     2 (100)|          |
    |   1 |  UPDATE                      | TEST         |       |       |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| TEST         |     1 |    28 |     2   (0)| 00:00:01 |
    |   3 |    INDEX RANGE SCAN          | TEST_DT_IND  |     1 |       |     1   (0)| 00:00:01 |
    |   4 |   TABLE ACCESS BY INDEX ROWID| ACCT         |     1 |    26 |     4   (0)| 00:00:01 |
    |   5 |    INDEX RANGE SCAN          | INDX_ACCT_DT |     1 |       |     3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------
    
    
    
    Full SQL Text
    
    SQL ID       SQL Text
    ------------ -----------------------------------------------------------------
    51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
                  NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
                 RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )
    Your contribution is very much appreciated.

    Thank you for taking your time to answer my question.


    Concerning

    Oracle Lover3 wrote:
    How will I know (from Plan 1 and Plan 2) whose execution plan chose for the current run?

    Since you're already on 10.2, you can identify the actual execution plan by checking in V$ SESSION SQL_ID and SQL_CHILD_NUMBER column. This can be used to identify the plan in V$ SQL_PLAN (columns SQL_ID and CHILD_NUMBER) and in 10g, you can use the convenient DBMS_XPLAN. Function DISPLAY_CURSOR for the information of the real plan using these two parameters.

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • How to see all passed to the db sql statements?

    Is it possible to configure Jdevloper (11.1.1.4) in a way so that it shows all the sql statements in the console?

    THX in advance

    You have restarted your WLS instance in debug mode?

  • execute the dynamic sql statement

    Hi all

    CREATE TABLE  XX_OFFICE_USER_IMP 
      (
        ID              NUMBER,
        OFFICE          VARCHAR2(10 BYTE),
        USER_NAME       VARCHAR2(10 BYTE),
        BANK_ACCOUNT_ID NUMBER,
        TRANSFERED      NUMBER
      )
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (421,'0000','F0000',10029,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (422,'0000','F0000',10031,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (423,'0000','F0000',10033,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (424,'0000','F0000',10036,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (425,'0000','F0000',10037,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (426,'0000','F0000',10039,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (427,'0000','F0000',10041,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (428,'0000','F0000',10046,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (429,'0000','F0000',10048,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (430,'0000','F0000',10067,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (431,'0000','F0000',10072,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (432,'0000','F0000',10087,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (433,'0000','F0000',10092,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (434,'0000','F0000',10008,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (435,'0000','F0000',10012,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (436,'0000','F0000',10013,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (437,'0000','F0000',10014,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (438,'0000','F0000',10017,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (439,'0000','F0000',10019,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (440,'0000','F0000',10024,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (441,'0000','F0000',10025,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (442,'0000','F0000',10001,null);
    Insert into xx_office_user_imp (ID,OFFICE,USER_NAME,BANK_ACCOUNT_ID,TRANSFERED) values (443,'0000','F0000',10002,null);
    CREATE TABLE XXBG_CASIER_CASH
      (
        CASHIER         VARCHAR2(32 BYTE),
        BANK_ACCOUNT_ID NUMBER(38,0)
      )
    declare 
    v_exe_grant varchar2(32767 char);
    begin 
    
    
    for i in (select * from xx_office_user_imp where office = '0000') loop
    
      insert into XXBG_CASIER_CASH values (i.user_name, i.bank_account_id);
    
      v_exe_grant := 
                     'create user '  || i.user_name || ' identified by ' || i.user_name || ';' 
                  || 'GRANT create session to ' || i.user_name || ';' 
                  || 'GRANT select on apps.XXBG_CE_STATEMENT_HEADERS_CASH to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.FND_USER TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.dFND_DESCR_FLEX_COL_USAGE_TL TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.fnd_descr_flex_column_usages to ' || i.user_name || ';' 
                  || 'GRANT select on apps.fnd_descriptive_flexs to ' || i.user_name || ';' 
                  || 'GRANT select on apps.fnd_descriptive_flexs_tl to ' || i.user_name || ';' 
                  || 'GRANT select on ce.ce_statement_headers to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.fnd_doc_sequence_assignments TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.CE_STATEMENT_HEADERS_S TO ' || i.user_name || ';' 
                  || 'GRANT EXECUTE ON APPS.XXBG_GET_NEXTVAL TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.CE_STATEMENT_LINES TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_CE_STATEMENT_LINES TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.CE_BANK_ACCOUNTS to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.CE_BANK_BRANCHES_V TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.XXBG_CASIER_CASH TO ' || i.user_name || ';' 
                  || 'GRANT EXECUTE ON APPS.XXBG_ST TO ' || i.user_name || ';' 
                  || 'GRANT select on ce.xxbg_ce_statement_lines_detail to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.ce_transaction_codes TO ' || i.user_name || ';' 
                  || 'GRANT select on ce.ce_statement_lines_s to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON CE.XXBG_CE_STATEMENT_LINES_DET_SQ TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.xx_pko_lines to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON apps.xx_rko_lines TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.XX_INVOICE_RELATIONS_CASH to ' || i.user_name || ';' 
                  || 'GRANT select on APPS.PO_VENDOR_SITES_ALL to ' || i.user_name || ';' 
                  || 'GRANT select on ap.AP_INVOICE_LINES_INTERFACE_S to ' || i.user_name || ';' 
                  || 'GRANT select on ap.AP_INVOICE_LINES_INTERFACE to ' || i.user_name || ';' 
                  || 'GRANT select on APPS.ap_distribution_set_lines_all to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_INVOICES_INTERFACE_S TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_INVOICES_INTERFACE TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_DISTRIBUTION_SETS_ALL  TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.ce_lookups  to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_CUST_SITE_USES_ALL to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_LOCATIONS to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_PARTIES to ' || i.user_name || ';' 
                  || 'GRANT select on ar.HZ_PARTY_SITES to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON AR.HZ_CUST_ACCT_SITES_ALL TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON AR.HZ_CUST_ACCOUNTS TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_CLAIMS_V TO ' || i.user_name || ';' 
                  || 'GRANT select on apps.xxbg_insis_agents_v to ' || i.user_name || ';' 
                  || 'GRANT select on ce.xxbg_cash_doc_types to ' || i.user_name || ';' 
                  || 'GRANT select on AP.AP_BANK_ACCOUNTS_ALL to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON AP.AP_BANK_BRANCHES TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.FND_DESCR_FLEX_CONTEXTS TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.FND_DESCR_FLEX_CONTEXTS_TL TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_SUPPLIERS to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.per_employees_x TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.fnd_doc_seq_categories_ap_v TO ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.AP_LC_INVOICE_TYPES_V to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON ce.xxbg_ce_statement_lines_sq to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_STATEMENT_HEADERS_CASH to ' || i.user_name || ';' 
                  || 'GRANT SELECT ON APPS.XXBG_INSIS_POLICY_V TO ' || i.user_name || ';' 
                  || 'GRANT insert  ON ce.ce_statement_lines to ' || i.user_name || ';' 
                  || 'GRANT INSERT  ON CE.XXBG_CE_STATEMENT_LINES_DETAIL TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.AP_INVOICES_INTERFACE TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.AP_INVOICE_LINES_INTERFACE TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.XX_RKO_LINES TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON APPS.XX_PKO_LINES TO ' || i.user_name || ';' 
                  || 'GRANT delete on ce.xxbg_ce_statement_lines_detail to ' || i.user_name || ';' 
                  || 'GRANT update on ce.XXBG_CE_STATEMENT_LINES_DETAIL to ' || i.user_name || ';' 
                  || 'GRANT DELETE ON CE.CE_STATEMENT_LINES TO ' || i.user_name || ';' 
                  || 'GRANT INSERT ON CE.CE_STATEMENT_HEADERS TO ' || i.user_name || ';' 
                  || 'GRANT update on CE.CE_STATEMENT_HEADERS to ' || i.user_name || ';' 
                  || 'GRANT update on ce.CE_STATEMENT_LINES to ' || i.user_name || ';' 
                  || 'GRANT select on apps.XX_AGENTS_NO_V to ' || i.user_name || ';' ;
                  
                  
      execute immediate v_exe_grant;
      
    update xx_office_user_imp
      set transfered = 1 
      where id = i.id
    ;
    
    v_exe_grant := '';
    end loop;
    
    end;
    /
    After execute the PL/SQL block I get the message:
    Error report:
    ORA-00911: invalid character
    ORA-06512: at line 79
    00911. 00000 -  "invalid character"
    *Cause:    identifiers may not start with any ASCII character other than
               letters and numbers.  $#_ are also allowed after the first
               character.  Identifiers enclosed by doublequotes may contain
               any character other than a doublequote.  Alternative quotes
               (q'#...#') cannot use spaces, tabs, or carriage returns as
               delimiters.  For all other contexts, consult the SQL Language
               Reference Manual.
    *Action:
    Any ideas? I think I call correct immediate execution.

    DB version: 11g

    Unfortunately I can't provide you the sql code of the other tables to create their... Maybe you should try without all budgets... :)


    Thanks in advance,
    Bahchevanov.

    Edited by: bahchevanov on 11 October 2012 06:14

    Bahchevanov wrote:
    Any ideas?

    Sure. EXECUTE IMMEDIATE executes a unique statement when you try to run the job. So use:

    execute immediate 'create user '  || i.user_name || ' identified by ' || i.user_name;
    execute immediate 'GRANT create session to ' || i.user_name;
    execute immediate 'GRANT select on apps.XXBG_CE_STATEMENT_HEADERS_CASH to ' || i.user_name;
    .
    .
    .
    

    SY.

  • Use of ROWID in the Update SQL statement

    Hi all

    I have an update statement that uses the rowid column to make the selection on the target table. Since a rowid represents the physical location of a row on disc, we know that this reference may change when various activities are conducted on the line of database/table/etc...

    Here is an example of the statement I post:

    UPDATE tabA outertab SET col1 = 'value '.
    WHERE EXISTS (SELECT 1 FROM tabA innertab WHERE outertab.) ROWID = outertab. ROWID AND...)

    Of course, the inner query is more complicated and uses other tables etc. but for the purposes of the example we don't need to include the details.

    My question is: what help rowid in a single statement SQL as a reference of a subquery in the outer statement is there a risk that outdoor activities can change the rowid and these changes be reflected in the session database that my query is executed which causes an incompatibility between the clause SQL internally and externally?

    In response to the question that will follow this post: 'why don't you just use a PK', we would like to avoid to maintain a PK on the table that we are talking about very large volumes of data and we do not want to have to appeal to a sequence, if we can avoid when we insert the data. If however there is a risk that this Update statement may fail, or update lines badly, then we might have to use a PK.

    I know there are a lot of discussions about this, but I havnt been able to find one that someone answered with any kind of confidence or clarity, any help would be appreciated.

    Thank you

    Keith

    Edited by: Turtle on March 5, 2009 05:24

    When using rowid in a single statement SQL as a reference of a subquery in the outer statement is there a risk that outdoor activities can change the rowid and these changes be reflected in the session database that my query is executed which causes an incompatibility between the clause SQL internally and externally?

    No, it's safe to use rowid in this query type. Docs

    A line assigned ROWID remains unchanged, unless the line is exported and imported using the import and export utilities. When you delete a row in a table, then commit the transaction enclosing, rowid of the deleted row can be attributed to a line inserted in a subsequent operation.

  • encoding for spaces in the url in an in the report sql statement

    1. what function or process use to code for empty spaces in a url link in a report?

    I need to link a report to a 2nd report and pass 5 variables. I think I need to do by integrating my own url in the sql code for the report, given that the standard State is defined for only 3 variables to pass.

    One of my variables as partner_firm has spaces, so how do I encode this in the query. Currently I have the following (simplified...).

    Select partner_firm,
    distinct_events County (separate event),
    "< a href =" f? p = 18509:4: & SESSION. : NO:4:P4_PARTNER_FIRM, P4_QUARTER, P4_CATEGORY, P4_PRODUCT_CATEGORY, P4_EVENT:' |
    partner_firm |
    2 c & P3_QUARTER.%2C & P3_CATEGORY.%2C & P3_PRODUCT_CATEGORY.%2C & P3_EVENT. » >' ||
    Count (distinct Lower (attendee_email)). '< /a >' distinct_attendees
    of all_events...

    but partner_firm spaces that are returned. I think there's the way that I can code for this?

    Thank you
    Stephen

    Of course there are:
    Select apex_util.url_encode ('http://ww.oracle.com/') of double

    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this response in marking it as useful or Correct ;-)

  • For the CASE of the Oracle SQL statement problem

    Follwing query run without any problem in oracle 12 c.

    SELECT

       BOX to_number (sysdate ' on()

             WHEN 6 THEN to_char(sysdate,'ww')+1

             WHEN 2 THEN to_char(sysdate,'ww')+1 

             ELSE to_char(sysdate,'ww')+ 1 END 

             FROM dual

    But the request fails below. Only change is WHEN 6 THEN to_char (sysdate 'ww') + 2

    SELECT

       BOX to_number (sysdate ' on()

             WHEN 6 THEN to_char(sysdate,'ww')+2

             WHEN 2 THEN to_char(sysdate,'ww')+1 

             ELSE to_char(sysdate,'ww')+ 1 END 

             FROM dual


    Data fault is ORA-01722 invalid number

    Hello

    Try below.

    SELECT

    CASE to_number (to_char(sysdate,'D'))

    WHEN 6 THEN to_char (sysdate, "ww") + 2

    WHEN 2 THEN to_char (sysdate, "ww") + 1

    END of ANOTHER to_char (sysdate, "ww") + 1

    OF the double

  • Logging has no SQL statements using the view system

    Hello

    We would like to improve our logging of errors of logging of sql statements failed.
    in other words, when a user does something in our system that generates a sql error.
    We want to connect to the corresponding sql statement.

    to do this, we need a way to get this statement by using a sql query.
    is there perhaps something like a point system with the sql statement failed where
    I can just go get the last being?

    would be very happy for some advice.

    Yes, you need to activate the first check. Checkout:

    http://www.Oracle-base.com/articles/10G/Auditing_10gR2.php
    http://www.tiplib.com/183/enable-auditing-Oracle-database

  • IDE channel - check the State DMA/PIO

    Hello

    I tried to check the DMA/PIO State of my system, but I couldn't find something that mentions primary/secondary channel under "controllers IDE ATA/ATAPI" in Device Manager. From what I've read in various forums, it is the way to do it, and I also noticed that a few people could not find the ' primary/secondary way' thing as well. (but I could not find a solution to the issue)

    My problem is that some USB ports (2 of 4) I used normally would slow when I transfer data to and from the external HARD drive. Now, I've been move to the other 2 USB ports, and I could see the difference in the rate of transfer. This has happened before with my XP system, but I was able to access the channel primary/secondary and turned them all to DMA, which is something that I can't do now with my other Vista system. So now I would really check on that, and I need help to make...

    My system:
    Windows Vista (updated with all the Windows update)
    Intel Core 2 Duo P9600 2.67 GHz
    4 GB OF RAM
    nVidia GeForce GTX 260-1 GB memory
    Realtek/Creative SoundBlaster
    HARD drive 320 (which is good, it's almost full, leaving about 20 GB of free space, but the problem that I mentioned above happened when I had still 60 GB of free space, as a few months ago)

    It would be great if someone can help me to brighten my days here. I'm not a geek, but certainly not an illiterate as well.

    Thank you in advance!

    Hi PC45,.

    In case you can't find primary/secondary channel under "controllers IDE ATA/ATAPI" in Device Manager, you can try to expand IDE ATA/ATAPI controllers and check for ATA channel 0 or right-click on it and click Properties. Later, click on the tab for setting advance, check if you can see the status of the DMA mode.

    Because you are connected to the USB and the data transfer rate is slow, and it works fine when connected to a different USB port, I suggest you to update the USB drivers on the motherboard manufacturer's website.

    You can also navigate to the link below and follow the steps to update the drivers on your computer.

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly

    Also, if you have any security software installed on your computer, you can try to temporarily disable and check if the date transfer rate is better. If you find the security software, the origin of the problem, you can contact the manufacturer of security software and check if there is no parameter to be changed. Later, re-enable the security software.

    I hope this helps. Let us know the status.

    Thank you and best regards,

    Srinivas R Microsoft Support.

    Visit our Microsoft answers feedback Forum and let us know what you think

  • Get the SQL statement error programmatically

    Hello

    error SQL in the FORMS, you can display the erroneous SQL statement pressing (shift) (Ctrl) E on the screen. Is there a way to get the text of the SQL statement in a PL/SQL function for logging purposes?

    I get the error using SQLERRM, it's not a problem. But how can I get the SQL text of the statement?

    Thanks and regards,

    Sascha

    Sascha,

    You should be able to use the: SYSTEM. System LAST_QUERY variable forms.

    Craig...

  • FDM generated SQL statement in the log file?


    Hello everyone, hopefully a simple question:

    When you perform an import using FDM, I know that behind the scenes of a SQL SELECT statement statement composed and performed on the database server. My question: the actual SQL statement is retained in a newspaper somewhere (so that we can see it?) In our case, it's an Oracle DB server and we use the ERPI adapter; not sure if it's relevant. We would like to enter this SQL statement and use it as a starting point for other things.

    Thanks in advance for anything you can offer.

    The statement SQL is not written in the journal of the adapter.  The only things that are registered are what show in the file card log if you enable loggin to the adapter source ERPi in action 'Get Data'.

  • Word key missing in to_number conversion in the SQL statement select error

    ORA-00905: lack keyword for the below SQL statement error. It should be of to_number (m.EQUIP_SUB_CLASS_ID, '9999')
    between 3800 and the 3699 where Clause. Is that what I miss in the SQL below?

    SELECT  M.EQUIP_NO,M.EQUIP_CLASS_ID, M.EQUIP_DESCR,M.ORG_ID
      from  MAMIS.EQUIP M
     where M.EQUIP_NO in  (  SELECT  M.EQUIP_NO  from  MAMIS.EQUIP M, MAMIS.ORG O 
    where upper(M.ORG_ID) like upper(O.ORG_ID) 
    and length(replace(translate(M.EQUIP_SUB_CLASS_ID, '0123456789', '000000000'), '0')) is null
    and upper(M.fleet_status) like 'ACTIVE'  
    and upper(M.ORG_ID) not like 'NA'  
    and to_number(m.EQUIP_SUB_CLASS_ID , '9999') 
    between 3699 and 3800  )

    Hello

    I don't see obvious errors.

    Whenever you have a problem, please post a full test script that people can run to recreate the problem and test their ideas. Include CREATE TABLE and INSERT statements for all of the tables involved and the results desired from these data. Format your code so people can read and understand.
    See the FAQ forum {message identifier: = 9360002}

    I saw a couple of things you need to know about Oracle, but none of them would cause an error "Missing key word".

    There is no point in using the LIKE operator if you do use wildcards. For example

    upper (M.fleet_status)      like 'ACTIVE'  
    

    is slower than, but otherwise equivalent to

    upper (M.fleet_status)      = 'ACTIVE'  
    

    What are you trying to do here?

    length ( replace ( translate ( M.EQUIP_SUB_CLASS_ID
                                , '0123456789'
                        , '000000000'
                        )
               , '0'
               )
           )               is null
    

    Want to see if m.equip_sub_class_id consists only of numbers, from ' 0 'to 9'?
    If so, you can simply say

    TRANSLATE ( m.equip_sub_class_id
           , 'X0123456789'
           , 'X'
           )          IS NULL
    

    Depending on your front end, you may need a sem, i-colon (;) the end of your query.

  • Determine the SQL statement from a trigger

    Hello

    I currently use triggers to write in an array of history/log.
    Is there anyway of the determination of the trigger - the actual sql statement that fired the trigger?

    Rob.

    This can help...

    CREATE OR REPLACE TRIGGER EMP_TRG1
    BEFORE UPDATE ON EMPLOYEES
    declare
    v_num NUMBER;
    sql_stmt varchar2(2000);
    sql_text ora_name_list_t;
    BEGIN
    v_num:=ora_sql_txt(sql_text);
    FOR i in 1..NVL(v_num,0) LOOP
    sql_stmt:=sql_stmt||sql_text(i);
    END LOOP;
    INSERT INTO EMP_LOG VALUES(sql_stmt);
    --dbms_output.put_line(sql_stmt);
    END;
    

    Re: capture of sql statement that activates the trigger
    Re: Get the text of the query to a trigger

Maybe you are looking for