Understanding logminer results -- inserting row into table with CLOB field

In using log miner I have noticed that inserts into rows that contain a CLOB (I assume this applies to other LOB type fields as well, have only tested with CLOB so far) field are actually recorded as two DML entries.
--the first entry is the insert operation that inserts all values with an EMPTY_CLOB() for the CLOB field
--the second entry is the update that sets the actual CLOB value (+this is true even if the value of the CLOB field is not being set explicitly+)
This separation makes sense as there may be separate locations that the values are being stored etc.
However, what I am tripping over is the fact the first entry, the Insert, has a RowId value of 'AAAAAAAAAAAAAAAAAA' which is invalid if I attempt to use it in a flashback query such as:
SELECT * FROM PERSON AS OF SCN #####'  where RowId = 'AAAAAAAAAAAAAAAAAA'The second operation, the Update of the CLOB field, has the valid RowId.
Now, again, this makes sense if the insert of the new row is not really considered "+done+" until the two steps are done. However, is there some way to group these operations together when analyzing the log contents to know that these two operations are a "+matched set+"?
Not a total deal breaker, but would be nice to know what is happening under the hood here so I don't act on any false assumptions.
Thanks for any input.
To replicate:
Create a table with CLOB field:
CREATE TABLE DEVUSER.TESTTABLE
        ID NUMBER
       , FULLNAME VARCHAR2(50)
      , AGE NUMBER  
      , DESCRIPTION CLOB
       );Capture the before SCN:
SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;Insert a new row in the test table:
INSERT INTO TESTTABLE(ID,FULLNAME,AGE) VALUES(1,'Robert BUILDER',35);
     COMMIT;Capture the after SCN:
SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;Start logminer session with the bracketing scn values and options etc:
EXECUTE DBMS_LOGMNR.START_LOGMNR(STARTSCN=>2619174, ENDSCN=>2619191, -
           OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + DBMS_LOGMNR.CONTINUOUS_MINE + -
           DBMS_LOGMNR.COMMITTED_DATA_ONLY + DBMS_LOGMNR.NO_ROWID_IN_STMT + DBMS_LOGMNR.NO_SQL_DELIMITER)Query the logs for the changes in that range:
SELECT
       commit_scn, xid,operation,table_name,row_id
       ,sql_redo,sql_undo, rs_id,ssn
       FROM V$LOGMNR_CONTENTS
    ORDER BY xid asc,sequence# ascResults:
2619178     0C00070028000000     START                  AAAAAAAAAAAAAAAAAA     set transaction read write
2619178     0C00070028000000     INSERT     TESTTABLE     AAAAAAAAAAAAAAAAAA     insert into "DEVUSER"."TESTTABLE" ...
2619178     0C00070028000000     UPDATE     TESTTABLE     AAAFEXAABAAALEJAAB     update "DEVUSER"."TESTTABLE" set "DESCRIPTION" = NULL ...
2619178     0C00070028000000     COMMIT                  AAAAAAAAAAAAAAAAAA     commitEdited by: 958701 on Sep 12, 2012 9:05 AM
Edited by: 958701 on Sep 12, 2012 9:07 AM

Scott,
Thanks for the reply.
I am inserting into the table over a database link.
I am using the new version of HTML Db (2.0)
HTML Db is connected to an Oracle 10 database I think, however the table I am trying to insert data into (via the database link) is in an Oracle 8 database - this is why we created a link to it as we couldn't have the HTML Db interacting with the Oracle 8 database directly due to compatibility problems (or so I've been told)
Simon

Similar Messages

  • Large insert op into table with indexes

    Hi,
    Oracle 8.1.7.0. Empty table (after truncate) with two indexes. Need to insert about 40 billions records. What is better way to complete this task:
    1. Drop indexes, insert data then build indexes.
    2. Simply insert data into table.
    Thanks.

    The only way to find out is to test... For example, I did a test on my single-cpu box with Oracle 9i. My test was to load all the rows from DBA_SOURCE (only 650k rows). I found that a single insert statement with bitmap indexes online ran faster than the total elapsed time for taking the indexes offline, inserting, and bringing the indexes back up...
    With 40-billion rows, I presume you're using partitioned tables and enabling parrallel DML. Thus, your test will be much different than mine...
    In past ETL projects I worked on, I found little difference in timing. I decided that I didn't want to drop indexes (it was ver8i) so I loaded the empty tables with indexes (and constraints) enabled...
    Stan

  • Inserting rows into table Based on Column Values.

    Hi,
    I am trying to inserting rows into a table based on Column.
    Id      Name        
    Data
    N 105.1.1
    http://www.example.com/New/105.1.1
    U 105.1.2               http://www.example.com/Used/105.1.2
    S 105.1.3               http://www.example.com/Sold/105.1.3
    I want a table like this. 
    I want to insert Data column value based on Id and Name Columns
    If Id = N and Name = 105.1.1 then Data value should be insert as   http://www.example.com/New/105.1.1
    If Id = U and Name = 105.1.2 then Data value should be  insert as  http://www.example.com/Used/105.1.2
    If Id = S and Name = 105.1.3 then Data value should be insert as   http://www.example.com/Sold/105.1.3
    Can you please help us to write query to insert above Data Column values based on Id and Name Columns.

    INSERT INTO tbl (col) SELECT
    CASE WHEN id='N' and Name='105.1.1 ' THEN 'http://www.example.com/New/105.1.1'
              WHEN id='U' and Name='105.1.2 ' THEN 'http://www.example.com/New/105.1.2'
    END col
    FROM anothertbl
    Sorry , cannot test it right now.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Read a file and insert rows into table

    Hi,
    i would like to know how read a file (expl.txt) with the utl_file package and after insert each row into the table (dataID).
    ie :
    file /tmp/expl.txt is containing :
    id1 id2 describe
    2 3 test1
    6 5 test2
    4 7 test3
    and
    table dataID (
    id1 number,
    id2 number,
    describe varchar2(100));
    Thanks you very much.

    Hello,
    You can use the TEXT_IO package.
    Perform an over-all search (right upper corner) on TEXT_IO, and in the results you will find a manual on how to use the package.
    Hope this will help you.
    Regards,
    Cindy

  • Object Browser - Insert row into table

    Hi,
    I'm attempting to simply INSERT a row into a table using the "Create Row" in the Object Browser. I enter in all the data for the row, and click the Create button. There is no process success message, just another entry form for the Create Row is displayed. When I query the table, the data I just entered for the row is not there. What is going on?
    Thank you,
    Laura

    What version are you using? 2.2.0.00.32
    What are the column datatypes? I have several VARCHAR2, NUMBER, DATE, and CHAR columns.
    Are you using (do you see) the Create or "Create and Create Another" button?
    Yes, I tried both the "Create" and "Create and Create Another" button.
    Does it work correctly on apex.oracle.com?
    Hmm...looks like I will have to request a new Workspace. I haven't logged into there for quite some time (forgot my Workspace name, etc.)...and the email address you have on file for me is no longer a valid email address.

  • Inserting records into Table with check table logic in place

    I want to insert records into a table, and have the check table to not allow invalid entries.  Is there a function out there that will allow this?  I am currently using the insert statement and it is working except that it is not giving an error when the value does not exist in the check table for the particular fields.
    INSERT INTO ZSD_XREF VALUES WA_XREF.
    That is the basic statement I'm using ZSD_XREF has several fields one being the material number field tied to the check table which happens to be MAKT file.  The insert statement is not validating the material numbers using the check table, or at least it is not giving an error.  Any ideas?

    Paul,
    Unfortunately, open SQL statements such as INSERT, UPDATE do not go through the check table logic as they directly hit the database layer. Check table checks are performed only if you go through application layer that is when you enter the same data through a screen.
    You have to do the checks yourself.
    Happy checking!!!
    Srinivas

  • Unable to insert row into table.

    hi all,
    here i am using oracle apex 3.2.0.0.0.27 version.
    i am unable to insert a row in the database table.when i press a save button i get an error is
    0.07:
    0.08: S H O W: application="132" page="4" workspace="" request="" session="3286250612369434"
    0.14: Language derived from: FLOW_PRIMARY_LANGUAGE, current browser language: en-us
    0.15: alter session set nls_language="AMERICAN"
    0.16: alter session set nls_territory="AMERICA"
    0.16: NLS: CSV charset=WE8MSWIN1252
    0.16: ...NLS: Set Decimal separator="."
    0.16: ...NLS: Set NLS Group separator=","
    0.16: ...NLS: Set date format="DD-MON-RR"
    0.17: ...Setting session time_zone to +05:30
    0.17: Setting NLS_DATE_FORMAT to application date format: DD-MON-YYYY HH:MIPM
    0.18: ...NLS: Set date format="DD-MON-YYYY HH:MIPM"
    0.19: NLS: Language=en-us
    0.21: Application 132, Authentication: CUSTOM2, Page Template: 102166708405540699
    0.27: ...Session ID 3286250612369434 can be used
    0.27: ...Application session: 3286250612369434, user=COMP
    0.28: ...Determine if user "COMP" workspace "16032411264866286" can develop application "132" in workspace "16032411264866286"
    0.29: ...Check for session expiration:
    0.31: Session: Fetch session header information
    0.33: ...Metadata: Fetch page attributes for application 132, page 4
    0.34: Fetch session state from database
    0.38: Branch point: BEFORE_HEADER
    0.39: Fetch application meta data
    0.49: Setting NLS_DATE_FORMAT to application date format: DD-MON-YYYY HH:MIPM
    0.49: ...NLS: Set date format="DD-MON-YYYY HH:MIPM"
    0.49: Computation point: BEFORE_HEADER
    0.49: Processing point: BEFORE_HEADER
    0.49: ...Process "Row_fetch": DML_FETCH_ROW (BEFORE_HEADER) F|#OWNER#:PC_MASTER:P4_PC_ID:PC_ID
    0.73: Show ERROR page...
    0.73: Performing rollback...
    0.79: Processing point: AFTER_ERROR_HEADER
    ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignored
         Error      UNABLE TO FETCH
    OK      
    please anyone can help me to come out this problem.
    thanks
    regards,
    tipan

    Hi Tipan,
    This error isn't due to you pressing save, it occurs when the page reloads because you are trying to fetch a record from a database table and the Primary Key APEX Page Item field doesn't have a value in it. You need to add a condition to your fetch so it only runs when the primary key page item has a value in it.
    Hope this helps
    Paul

  • Getting table script using dbms_metadata.get_ddl, but with clob field

    So, Oracle 11g R2..
    I'm using dbms_metadata.get_ddl to get table scripts and it's working fine..
    now, I have a table with clob field, and it's not working... I got an 'missing right parenthesis (ora-0907)' error...
    I could paste a script that I got, but I don't think it makes any sense..
    does anybody have some experience on using this package on clob tables?
    tnx

    this is script that I got... it's long, and it looks like it's not good
    CREATE TABLE "COMMON"."TEST_AAA2"
       (    "ID" NUMBER(10,0),
        "TEKST" VARCHAR2(200 CHAR),
        "UPDATESTAMP" DATE,
        "OBJEKAT" CLOB,
         CONSTRAINT "TEST_PART_PK2" PRIMARY KEY ("ID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "USERS"
      ALTER INDEX "COMMON"."TEST_PART_PK2"  UNUSABLE ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS  LOGGING
      STORAGE(
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT))
      PARTITION BY RANGE ("UPDATESTAMP")
    (PARTITION "P_201012"  VALUES LESS THAN (TO_DATE(' 2011-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201101"  VALUES LESS THAN (TO_DATE(' 2011-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201102"  VALUES LESS THAN (TO_DATE(' 2011-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_ARCHIVE"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201103"  VALUES LESS THAN (TO_DATE(' 2011-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201104"  VALUES LESS THAN (TO_DATE(' 2011-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_ARCHIVE"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201105"  VALUES LESS THAN (TO_DATE(' 2011-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201106"  VALUES LESS THAN (TO_DATE(' 2011-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_ARCHIVE"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 RETENTION
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_201107"  VALUES LESS THAN (TO_DATE(' 2011-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS ,
    PARTITION "P_MAXVALUE"  VALUES LESS THAN (MAXVALUE)
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "COMMON_DATA"
    LOB ("OBJEKAT") STORE AS BASICFILE (
      TABLESPACE "COMMON_ARCHIVE" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) NOCOMPRESS )

  • Insert result of sql into table

    Hi all, how do I insert result of sql into table marco_ttmp ?
    I tried this, but it doesn't work, it returns "ORA-00928: missing SELECT keyword"
    insert into marco_ttmp (var_id,arcdate,contragentid,lpnd,lusd,lkk)
    with
    rrk as (
    select '01112010' as mydate FROM dual d
    union all
    select '01122010' as mydate FROM dual d
    rru as (
    select '33' contragentid from dual d
    union all 
    select '56' contragentid from dual d
    b as (
    select '01112010' as arcdate, '33' as contragentid, 'tt' as t from dual
    union all
    select '01122010' as arcdate, '56' as contragentid, 'un' as t from dual
    union all
    select '01122010' as arcdate, '33' as contragentid, 'kp' as t from dual
    union all
    select '01112010' as arcdate, '56' as contragentid, 'ur' as t from dual
    d as (
    select '01112010' as arcdate, '33' as contragentid, 'dr' as y from dual
    union all
    select '01122010' as arcdate, '56' as contragentid, 'rh' as y from dual
    union all
    select '01122010' as arcdate, '33' as contragentid, 'tr' as y from dual
    union all
    select '01112010' as arcdate, '56' as contragentid, 'wn' as y from dual
    v as ( select '555' as kkt from dual ),
    kkt as ( select count(*)+5 kkt from v )
    --insert into marco_ttmp (var_id,arcdate,contragentid,lpnd,lusd,lkk)
    select substr(rrk.mydate,4,2) || '.' || rru.contragentid var_id,
    rrk.mydate as arcdate,
    rru.contragentid as contragentid,
    count(b.arcdate) lpnd,count(d.arcdate) lusd,
    kkt.kkt lkk
    from kkt cross join rrk cross join rru
    left outer join b on b.arcdate = rrk.mydate and b.contragentid = rru.contragentid
    left outer join d on d.arcdate = rrk.mydate and d.contragentid = rru.contragentid
    group by rrk.mydate, rru.contragentid, kkt.kkt

    Moved "insert into" to the beginning of statement, everything works.
    insert into marco_ttmp (var_id,arcdate,contragentid,lpnd,lusd,lkk)
    with
    rrk as (
    select '01112010' as mydate FROM dual d
    union all
    select '01122010' as mydate FROM dual d
    rru as (
    select '33' contragentid from dual d
    union all 
    select '56' contragentid from dual d
    b as (
    select '01112010' as arcdate, '33' as contragentid, 'tt' as t from dual
    union all
    select '01122010' as arcdate, '56' as contragentid, 'un' as t from dual
    union all
    select '01122010' as arcdate, '33' as contragentid, 'kp' as t from dual
    union all
    select '01112010' as arcdate, '56' as contragentid, 'ur' as t from dual
    d as (
    select '01112010' as arcdate, '33' as contragentid, 'dr' as y from dual
    union all
    select '01122010' as arcdate, '56' as contragentid, 'rh' as y from dual
    union all
    select '01122010' as arcdate, '33' as contragentid, 'tr' as y from dual
    union all
    select '01112010' as arcdate, '56' as contragentid, 'wn' as y from dual
    v as ( select '555' as kkt from dual ),
    kkt as ( select count(*)+5 kkt from v )
    select substr(rrk.mydate,4,2) || '.' || rru.contragentid var_id,
    rrk.mydate as arcdate,
    rru.contragentid as contragentid,
    count(b.arcdate) lpnd,count(d.arcdate) lusd,
    kkt.kkt lkk
    from kkt cross join rrk cross join rru
    left outer join b on b.arcdate = rrk.mydate and b.contragentid = rru.contragentid
    left outer join d on d.arcdate = rrk.mydate and d.contragentid = rru.contragentid
    group by rrk.mydate, rru.contragentid, kkt.kkt

  • Inserting XML String into Table with help of Stored Proc

    I will be getting XML String from JAVA, which I have to insert in Table A, XML String is as follows
    <?xml version = '1.0'?>
    < TableA>
    <mappings Record="3">
    < MESSAGEID >1</ MESSAGEID >
    < MESSAGE >This  is available at your address!</ MESSAGE>
    </mappings>
    <mappings Record="3">
    < MESSAGEID >2</ MESSAGEID>
    < MESSAGE >This isn’t available at your address. </ MESSAGE>
    </mappings>
    </ TableA >
    Table Structure*
    MESSAGEID     VARCHAR2(15 BYTE)
    MESSAGE     VARCHAR2(500 BYTE)
    This is the stored procedure which I have written to insert data into TableA, V_MESSAGE will be input parameter for inserting XML String 
    create or replace procedure   AP_DBI_PS_MESSAGE_INSERT
    V_MESSAGE VARCHAR2(1024)
    AS
    declare
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    V_FILEHANDLE UTL_FILE.FILE_TYPE;
    begin
    -- the name of the table as specified in our DTD
    xmlgen.setRowsetTag('TableA');
    -- the name of the data set as specified in our DTD
    xmlgen.setRowTag('mappings');
    -- for getting the output on the screen
    dbms_output.enable(1000000);
    -- open the XML document in read only mode
    v_FileHandle := utl_file.fopen(V_MESSAGE);
    --v_FileHandle := V_MESSAGE;
    loop
    BEGIN
    utl_file.get_line(v_FileHandle, charString);
    exception
    when no_data_found then
    utl_file.fclose(v_FileHandle);
    exit;
    END;
    dbms_output.put_line(charString);
    if finalStr is not null then
    finalStr := finalStr || charString;
    else
    finalStr := charString;
    end if;
    end loop;
    -- for inserting the XML data into the table
    rowsp := xmlgen.insertXML('ONE.TableA',finalStr);
    dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
    xmlgen.resetOptions;
    end;Please Help
    Edited by: 846857 on Jul 18, 2011 10:55 PM

    with t as (select xmltype('<TableA >
                               <mappings Record="3">
                               <MessageId>1</MessageId>
                               <Message> This bundle is available at your address!</Message>
                               </mappings>
                               <mappings Record="3">
                               <MessageId>2</MessageId>
                               <Message>This isn’t available at your address. </Message>
                               </mappings>
                               </TableA  >') col FROM dual)
      --End Of sample data creation with subquery factoring.
      --You can use the query from here with your table and column name.
    select EXTRACTVALUE(X1.column_value,'/mappings/MessageId') MESSAGEID
          ,EXTRACTVALUE(X1.column_value,'/mappings/Message') MESSAGE
    from t,table(XMLSEQUENCE(extract(t.COL,'/TableA/mappings'))) X1;Above Code works as i get result
    MESSAGEID     MESSAGE
    1             This bundle is available at your address!
    2             This isn’t available at your address.
    _____________________________________________ now I want to insert the result into Table A... How to proceed... Please help
    Edited by: 846857 on Jul 19, 2011 12:15 AM

  • How I can insert one row on table,  with columns settings: readonly = true

    I have a problem. (jdeveloper 11.1.1.2.0)
    How I can insert row on table (EditingMode= clickToEdit), with columns settings: ReadOnly = true.
    When I make click on button create insert, ADF create one row on the table with output text invisible ( ReadOnly = true.)
    I make double click, then output text is visible (ReadOnly = false)
    I dont want make double click. I want output text is visible (ReadOnly = false), when I make click on button create insert
    Thanks

    Hi,
    try changing the edit mode of the table when pressing the button and refresh the button. This of course turns the whole table into editable mode, but this is how it needs to work. Alternatively, you create an input form for the user to edit the new record and show the form in a popup or beneath the table. Then when the user submits the created row data, you refresh the table to shwo the new row
    Frank

  • Need to insert rows into 100 tables at a time

    hi there,
    below is our script for creation of 100 tables...
    we need a plsql script, to insert rows into 100 tables at a single time...
    please help us...vey urgent...
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(2000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_table'||counter||'
    (id integer primary key, col_a VARCHAR2(42),col_b date,col_c number,col_d varchar2(20),col_e varchar2(20),
    col_f varchar2(20),col_g varchar2(20),col_h date,col_i varchar2(20),col_j varchar2(20),col_k date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    /

    hi,
    below is our procedure and the error we are getting...
    Name Null? Type
    ID VARCHAR2(10)
    COL_A VARCHAR2(10)
    COL_B VARCHAR2(10)
    COL_C VARCHAR2(10)
    COL_D VARCHAR2(10)
    COL_E VARCHAR2(10)
    COL_F VARCHAR2(10)
    COL_G VARCHAR2(10)
    COL_H VARCHAR2(10)
    COL_J DATE
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(4000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_a'||counter||'
    (id varchar2(10), col_a varchar2(10), col_b varchar2(10), col_c varchar2(10), col_d varchar2(10), col_e varchar2(10),
    col_f varchar2(10), col_g varchar2(10), col_h varchar2(10), col_j date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2 (2000);
    BEGIN
    FOR OuterCounter IN 1 .. 100 LOOP --- table prefix in which it is to be inserted
    FOR InnerCounter IN 1 .. 100 LOOP --- records to be inserted
    sql_string := 'INSERT INTO emp_a' || Outercounter || ' (id, col_a, col_b, col_c, col_d, col_e, col_f, col_g, col_h, col_j)
    VALUES ('
    || InnerCounter || ', to_char( ''col_a''' || innercounter || '),'
    || InnerCounter || ', to_char( ''col_d''' || innercounter || '),'
    || ', to_char( ''col_e''' || innercounter || '),'
    || ', to_char( ''col_f''' || innercounter || '),'
    || ', to_char( ''col_g''' || innercounter || '),'
    || ', to_char( ''col_h''' || innercounter || '),'
    || ', to_char( ''col_j''' || innercounter || '), SYSDATE)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END LOOP;
    END;
    DECLARE
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    ORA-06512: at line 17
    please check the procedure and write the correct one...

  • Help in inserting rows into a table

    I have a table called acct_fact,
    I need to insert rows in the table using a script but the problem is there's a column called seq_nbr which has random seq nbr of 14character length like 'ZWX98MGD9MVAD6J','ZWX98MG67RVAD6J' etc.,
    While inserting rows I need to generate such seq_nbr for those columns and insert rows into the table, can I use any such mechanism in my insert query to insert such random nbr's while inserting rows into a table.
    If so please suggest me

    Hi Peter,
    Thankyou for the quick reply:)
    can you suggest me how to implement it here in my script snippet:
    while read var_acct_nbr
    do
    echo "update acct_attr set acct_attr_exp_dt ='$ExpDate' where Acct_Attr_Value_Text='15' and acct_attr_exp_dt is null and person_id='LDCarrBillAgrm' and acct_nbr='$var_acct_nbr' ;" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    echo "insert into acct_fact values ('$var_acct_nbr','$ExpDate','$ExpTime','*seq_nbr*','N','ProjTereza','Remoção de acordo d; data de expiração: $ExpDate',null,'1','LDE',null);" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    done < ./$DirectoryName/ExpireAccts_$TimeStamp.LOG
    the script takes each acct_nbr nbr form a input file and fires an insert statement.
    The one in bold is the column where such sequence need to be inserted.can you help me in implementing the way you suggested in my script i.e., insert statement
    Thanks in Advance:)
    Edited by: rkrish on Jun 27, 2012 3:04 AM

  • Inserting image into table

    hi,
    i m create table, then create procedure, procedure is successfully compile, but when i m trying to insert image into table it error out.
    for inserting image i go with
    EXECUTE insert_image_file(1,'C:\sunset.jpg');
    sunset.jpg is image which i want to insert in table, and which is present on 'c drive'.
    when execute the following error are shown
    ORA-22285: non-existent directory or file for FILEOPEN operation
    ORA-06512: at "SYS.DBMS_LOB", line 635
    ORA-06512: at "SCOTT.INSERT_IMAGE_FILE", line 26
    ORA-06512: at line 1
    how to solve it.
    regards
    prashant

    Prashant wrote:
    CREATE OR REPLACE PROCEDURE insert_image_file (p_id NUMBER, p_image_name IN VARCHAR2)
    ...snipped...Not very nice code... why create an empty image row, then lock it (it is already locked by the uncommitted insert statement), and then update it again? Not very efficient or sensible.
    image is on local machine.When a row is created on the server from user input on some PC, who supplied that input? Who read the user's keyboard input on that PC to obtain the values for the columns for the row to create?
    Did PL/SQL read the keyboard of that remote PC? Of course not. The client program on that PC read the keyboard input. It then made a client call to the Oracle server. It supplied the data entered via the keyboard by the user to the Oracle server (using a PL/SQL call or using a SQL statement call to Oracle).
    Now why would a local image data on that PC be treated any differently than the keyboard data on that PC? How can you expect PL/SQL code running on the Oracle server, to read that image data from the remote PC when the same PL/SQL code is incapable of reading keyboard input from that very same PC?
    You need to review your understanding of client-server and how it pertains to using Oracle within client-server architecture.

  • Inserting rows in table control(Module pool)!!

    Hi,
    Pls provide me with some code sample for inserting rows in a table control (module pool)...
    Regards
    Gunjan

    HI
    Y dont u create a TABLE CONTROL using wizard and copy the coding-
    TRY THIS-
    WHEN 'INSR'.                      "insert row
           PERFORM FCODE_INSERT_ROW USING    P_TC_NAME
                                             P_TABLE_NAME.
    FORM fcode_insert_row
                   USING    P_TC_NAME           TYPE DYNFNAM
                            P_TABLE_NAME             .
    &SPWIZARD: BEGIN OF LOCAL DATA----
       DATA L_LINES_NAME       LIKE FELD-NAME.
       DATA L_SELLINE          LIKE SY-STEPL.
       DATA L_LASTLINE         TYPE I.
       DATA L_LINE             TYPE I.
       DATA L_TABLE_NAME       LIKE FELD-NAME.
       FIELD-SYMBOLS <TC>                 TYPE CXTAB_CONTROL.
       FIELD-SYMBOLS <TABLE>              TYPE STANDARD TABLE.
       FIELD-SYMBOLS <LINES>              TYPE I.
    &SPWIZARD: END OF LOCAL DATA----
       ASSIGN (P_TC_NAME) TO <TC>.
    *&SPWIZARD: get the table, which belongs to the tc                     *
       CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body
       ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline
    *&SPWIZARD: get looplines of TableControl                              *
       CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME.
       ASSIGN (L_LINES_NAME) TO <LINES>.
    *&SPWIZARD: get current line                                           *
       GET CURSOR LINE L_SELLINE.
       IF SY-SUBRC <> 0.                   " append line to table
         L_SELLINE = <TC>-LINES + 1.
    *&SPWIZARD: set top line                                               *
         IF L_SELLINE > <LINES>.
           <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 .
         ELSE.
           <TC>-TOP_LINE = 1.
         ENDIF.
       ELSE.                               " insert line into table
         L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1.
         L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1.
       ENDIF.
    *&SPWIZARD: set new cursor line                                        *
       L_LINE = L_SELLINE - <TC>-TOP_LINE + 1.
    *&SPWIZARD: insert initial line                                        *
       INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE.
       <TC>-LINES = <TC>-LINES + 1.
    *&SPWIZARD: set cursor                                                 *
       SET CURSOR LINE L_LINE.
    ENDFORM.                              " FCODE_INSERT_ROW
    HOpe this helps u
    Regds,
    Seema.

Maybe you are looking for

  • System Prefs Users&Groups crash on unlock

    Hi there, my Mac pro 2,1 running 10.7.5 has a few issues. One of them is that the System prefs Users&Groups crashes on unlocking the padlock. After I entered the password (I'm the admin) System Prefs crash. I have no problems accessing the other syst

  • Contact Person Relationship not displaying in webUI

    Hi, I am facing an issue while creating the Contact Person relationship in webUI. It is displaying in back end (GUI) drop down box, but its not displaying in web UI dropdown box. All other relationships are displaying well in UI.Please suggest to ove

  • Tomcat server installation on Windows 98

    hi,mine is P3 and I use Windows 98. I am trying to install tomcat server version 3.3.2, jdk version 1.4. I have set the paths of JAVA_HOME, TOMCAT_HOME to the respective directories as follows in the autoexec.bat file set JAVA_HOME=c:\jdk1.4 set path

  • Lazy downloading broken for updated jar-files?

    Hello, Using webstart-6.0 + jar-index + download="lazy" works great - jar files are downloaded on demand when they are really needed. However when updating all jar-files, the files that have been downloaded lazily and cached before are downloaded aga

  • Flash not working anywhere in Firefox IE is fine

    Ok, so, I'm getting really irritated with Flash. I talked to a friend who was having flash problems and they said they downloaded Firefox and it fixed the problem. Well, after doing EVERYTHING else first, I thought, what the heck, maybe it might actu