DML handler in streams.

IS there any way to get the users information in a dml handler of streams?
I want in my log table, the information about the user also who had performed the DML in an stream environment.
My approach for DML handler is just like ...
----Log table
CREATE TABLE strmadmin.history_row_lcrs(
timestamp DATE,
source_database_name VARCHAR2(128),
command_type VARCHAR2(30),
object_owner VARCHAR2(32),
object_name VARCHAR2(32),
tag RAW(10),
transaction_id VARCHAR2(10),
scn NUMBER,
commit_scn NUMBER,
old_values SYS.LCR$_ROW_LIST,
new_values SYS.LCR$_ROW_LIST)
NESTED TABLE old_values STORE AS old_values_ntab
NESTED TABLE new_values STORE AS new_values_ntab;
---procedure for inserting value/user defined DML handler...
CREATE OR REPLACE PROCEDURE history_dml(in_any IN ANYDATA)
IS
lcr SYS.LCR$_ROW_RECORD;
rc PLS_INTEGER;
BEGIN
-- Access the LCR
rc := in_any.GETOBJECT(lcr);
-- Insert information about the LCR into the history_row_lcrs table
INSERT INTO strmadmin.history_row_lcrs VALUES
(SYSDATE, lcr.GET_SOURCE_DATABASE_NAME(), lcr.GET_COMMAND_TYPE(),
lcr.GET_OBJECT_OWNER(), lcr.GET_OBJECT_NAME(), lcr.GET_TAG(),
lcr.GET_TRANSACTION_ID(), lcr.GET_SCN(), lcr.GET_COMMIT_SCN,
lcr.GET_VALUES('old'), lcr.GET_VALUES('new', 'n'));
-- Apply row LCR
lcr.EXECUTE(true);
END;
Thanks
Kapil

Hi Damorgan,
I will try this in my stream environment, but i am little doubtfull that this will work. the reason why i am saying this is if i will right this in my user_proc which is a dml handler for my stream environment, then these statement will run on the DB where i have "apply process" and i am not sure what user id or seession id these statements will give in that case..any way thankyou for your attention on a post about streams. i will post the result soon.
Kapil

Similar Messages

  • Ask about DML Handler for Streams at the Schema level ?

    Hi all !
    I use Oracle version 10.2.0.
    I have two DB is A (at machine A, and it used as source database) and B (at machine B - destination database). Some changes from A will apply to B.
    At B, I installed oracle client to use EMC (Enterprise Manager Console) tool to generate some script, and use them to configure Streams environment, I configured Streams at the Schema level (DML and DDL) => I successed ! But I have two problems is:
    + I write a DML Handler, called "emp_dml_handler" and want set it to EMP table only. So, I must DBMS_STREAMS_ADM.ADD_TABLE_RULES ? (I configured: DBMS_STREAMS_ADM.ADD_SCHEMA_RULES) such as:
    BEGIN
    DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
    schema_name => '"HOSE"',
    streams_type => 'APPLY',
    streams_name => 'STRMADMIN_BOSCHOSE_REGRES',
    queue_name => 'apply_dest_hose',
    include_dml => true,
    include_ddl => true,
    source_database => 'DEVELOP.REGRESS.RDBMS.DEV.US.ORACLE.COM');
    END;
    and after:
    DECLARE
    emp_rule_name_dml VARCHAR2(50);
    emp_rule_name_ddl VARCHAR2(50);
    BEGIN
    DBMS_STREAMS_ADM.ADD_TABLE_RULES(
    table_name => 'HOSE.EMP,
    streams_type => 'APPLY',
    streams_name => 'STRMADMIN_BOSCHOSE_REGRES',
    queue_name => 'apply_dest_hose',
    include_dml => true,
    include_ddl => true,
    source_database => 'DEVELOP.REGRESS.RDBMS.DEV.US.ORACLE.COM',
    dml_rule_name => emp_rule_name_dml,
    ddl_rule_name => emp_rule_name_ddl);
    DBMS_APPLY_ADM.SET_ENQUEUE_DESTINATION(
    rule_name => emp_rule_name_dml,
    destination_queue_name => 'apply_dest_hose');
    END;
    BEGIN
    DBMS_APPLY_ADM.SET_DML_HANDLER(
    object_name => 'HOSE.EMP',
    object_type => 'TABLE',
    operation_name => 'UPDATE',
    error_handler => false,
    user_procedure => 'strmadmin.emp_dml_handler',
    apply_database_link => NULL,
    apply_name => NULL);
    END;
    ... similar for INSERT and DELETE...
    I think that I only configure streams at the schema level and exclude EMP table, am i right ?
    + At the source, EMP table have a primary key. And I configured:
    ALTER TABLE HOSE.EMP ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
    ==> So, at the destination, have some works that I must configure the substitute key for EMP table ?
    Have some ideas for my problems ?
    Thanks
    Edited by: changemylife on Sep 24, 2009 10:45 PM

    If you want to discard emp from schema rule, then just add a negative rule, either on capture or apply.
    What is the purpose of :
    DBMS_APPLY_ADM.SET_ENQUEUE_DESTINATION(
    rule_name => emp_rule_name_dml,
    destination_queue_name => 'apply_dest_hose');sound like you are enqueunig into 'apply_dest_hose' all the rows for this table that comes from ... 'apply_dest_hose'
    Next you declare a DML_HANDLER that is attached to nobody :
    BEGIN
    DBMS_APPLY_ADM.SET_DML_HANDLER(
    object_name => 'HOSE.EMP',
    object_type => 'TABLE',
    operation_name => 'UPDATE',
    error_handler => false,
    user_procedure => 'strmadmin.emp_dml_handler',
    apply_database_link => NULL,
    apply_name => NULL);           <----- nobody rules the world!
    END;the sequence of evaluation is normally :
    APPLY_PROCESS (reader)
              |
              | -->  RULE SET
                          |
                          | --> RULE .....
                          | --> RULE
                                     |
                                     | --> evaluate OK then --> exist DML_HANDLER  --> YES --> call DML_HANDLER --> on LCR.execute call coordinator
                                                                                            |
                                                                                            | NO
                                                                                            |                                                                 
                                                                                       Implicit apply (give LCR to coordinator which dispatch to one apply server)    
                                                      Since your dml_handler is attached to null apply process it will never be called by anybody and your LCR for table emp will be implicit applied by its apply process.

  • Help on update statement in Apply DML Handler

    I followed the example given in Streams document.
    The document has the code for converting DELETE on the source to INSERT on the target. I added the dml handler code INSERT and UPDATE statements also.
    In DELETE, INSERT, UPDATE dml handler code, I am setting the command type to 'INSERT' so that I can insert the data in the target table.
    It is working fine for DELETE and INSERT statements.
    When I do update on the source table,
    I see only the value for the column I updated and all other columns are showing blank. May be this is the normal behaviour. How do I see the values for entire record. Do I need to join the source table based on the key column to get the data for the columns that were not updated.
    Also, I thought I should at least see the values for key column and updated column in the target table. It only shows the value for updated column but not for key column. But, When I choosed the old values (I know we need new values, but I just did it for test purpose) in the UPDATE DML handler, it shows the values for key column and the updated column.
    When I read the data in the LCR record using get_value('old', 'EMPLOYEE_ID') and get_value('NEW', 'FIRST_NAME')
    for key column, it shows the value in both old and new. I do not understand why it is not inserting the key column value in the target table.
    Thanks for your help in advance.
    Best regards,

    I forgot to mention these things.
    We added supplmental logging using alter database add supplemental log data (primary key, unique index) columns;
    I also added the supplemental logging on the source key column (employee_id) using ALTER TABLE emp ADD SUPPLEMENTAL LOG GROUP log_group_emp_pk (employee_id) ALWAYS;
    I also set the key column on the target table using DBMS_APPLY_ADM.SET_KEY_COLUMNS.
    Thanks for your help in advance.
    Best regards,

  • Doubt on user procedure used in dml handler?

    I am calling a user procedure in dml handler of apply process.I dont want my apply to apply changes.Instead i want to insert in a table <history_row_lcrs> the values which are captured by captured process.
    history_row_lcrs table has columns (date_t date, deptno number,dname varchar2(10), loc varcha2(10))
    deptno,dname,loc are the values captured as streams on dept table.
    I want to know the syntax to extract these values from LCR.(that is,to accomodate in the insert statement where i have written<what?>)
    CREATE OR REPLACE PROCEDURE history_dml(in_any IN SYS.ANYDATA)
    IS
    lcr SYS.LCR$_ROW_RECORD;
    rc PLS_INTEGER;
    BEGIN
    -- Access the LCR
    rc := in_any.GETOBJECT(lcr);
    -- Insert information in the LCR into the history_row_lcrs table
    INSERT INTO strmadmin.history_row_lcrs VALUES
    (SYSDATE,<what??>,<what?>,<what?>); --------
    -- Apply row LCR
    lcr.EXECUTE(false);
    END;
    /

    Once a DML handler for an object is called by APPLY, the user procedure has complete control of what to do with the LCR.
    In your case, use the example provided in the streams documentation on how to view the contents of an LCR and use that in your INSERT statement. See the partial code snippet below:
    Finally, you need to remove lcr.execute(FALSE) to prevent apply from applying the change.
    CREATE OR REPLACE PROCEDURE print_any(data IN ANYDATA) IS
    tn VARCHAR2(61);
    str VARCHAR2(4000);
    chr VARCHAR2(1000);
    num NUMBER;
    dat DATE;
    rw RAW(4000);
    res NUMBER;
    BEGIN
    IF data IS NULL THEN
    DBMS_OUTPUT.PUT_LINE('NULL value');
    RETURN;
    END IF;
    tn := data.GETTYPENAME();
    IF tn = 'SYS.VARCHAR2' THEN
    res := data.GETVARCHAR2(str);
    ELSIF tn = 'SYS.CHAR' then
    res := data.GETCHAR(chr);
    ELSIF tn = 'SYS.VARCHAR' THEN
    res := data.GETVARCHAR(chr);
    ELSIF tn = 'SYS.NUMBER' THEN
    res := data.GETNUMBER(num);
    ELSIF tn = 'SYS.DATE' THEN
    res := data.GETDATE(dat);
    END IF;
    END print_any;
    CREATE OR REPLACE PROCEDURE history_dml(in_any IN SYS.ANYDATA)
    IS
    lcr SYS.LCR$_ROW_RECORD;
    old_val SYS.LCR$_ROW_RECORD;
    new_val SYS.LCR$_ROW_RECORD;
    sql_text varchar2(4000) := 'insert into history_dml values (sysdate, ';
    rc PLS_INTEGER;
    BEGIN
    -- Access the LCR
    rc := in_any.GETOBJECT(lcr);
    if lcr.get_command_type()='INSERT' then
    -- Insert will only have new values, Update will have both old and new values and
    -- Delete will only have old values.
    new_val := lcr.get_values('NEW');
    FOR i IN 1..new_val.COUNT LOOP
    IF new_val(i) IS NOT NULL THEN
    -- Make sure you put any quotes and commas here.
    -- You can also create separate variables for the columns in the insert and
    -- assign their values using print_any
    sql_text := sql_text || print_any(oldlist(i).data);
    END IF;
    END LOOP;
    execute immediate sql_text;
    EXCEPTION
    <handle any errors here>
    END;

  • DML Handler issue

    I am having a streams environment which is replicating say scott.emp bewteen to two database on two diffrent machine.
    I have a dml handler user procedure having body :-
    CREATE OR REPLACE PROCEDURE emp_dml_handler(in_any IN ANYDATA) IS 
    lcr          SYS.LCR$_ROW_RECORD;
      rc           PLS_INTEGER;
      command      VARCHAR2(30);
      old_values   SYS.LCR$_ROW_LIST;
    BEGIN   
      -- Access the LCR
      rc := in_any.GETOBJECT(lcr);
      -- Get the object command type
      command := lcr.GET_COMMAND_TYPE();
        -- Set the command_type in the row LCR to INSERT
      lcr.SET_COMMAND_TYPE('INSERT');
      -- Set the object_name in the row LCR to EMP_DEL
      lcr.SET_OBJECT_NAME('EMPLOYEE_AUDIT');
      -- Set the new values to the old values for update and delete
      IF command IN ('DELETE', 'UPDATE') THEN
          -- Get the old values in the row LCR
          old_values := lcr.GET_VALUES('old');
          -- Set the old values in the row LCR to the new values in the row LCR
          lcr.SET_VALUES('new', old_values);
          -- Set the old values in the row LCR to NULL
          lcr.SET_VALUES('old', NULL);
    END IF;
      -- Add a SYSDATE for upd_date
      lcr.ADD_COLUMN('new', 'UPD_DATE', ANYDATA.ConvertDate(SYSDATE));
      -- Add a user column
      lcr.ADD_COLUMN('new', 'user_name',
                                lcr.GET_EXTRA_ATTRIBUTE('USERNAME') );
      -- Add an action column
      lcr.ADD_COLUMN('new', 'ACTION', ANYDATA.ConvertVarChar2(command));
    -- Make the changes
      lcr.EXECUTE(true);
    commit;
    END;whn i associate this dml handler with my streams environment, it stops replicating the changes although inserts the data into audit table (using this dml handler)
    Can any body tell me why this is happening??
    If i unset this dml handler replication starts taking place.
    I am using 10Gr2.
    Thnaks
    Kapil

    Woot, we found the issue. Although the DML was running we forgot to add "SQL INSERT action" to the "Database Manipulation Request" property of the button.
    Cheers,
    Ghoulies

  • DML Handler for update - need help

    Hi,
    I am trying a simple DML handler to INSERT all the column values in a target table (CHANNELS_DML)..which are sourced from an updated table (CHANNEL). Both of these tables are in the same database.
    Here is the procedure I'm using for this purpose..
    +++++++++++++++++
    CREATE OR REPLACE PROCEDURE chn_dml_handler(in_any IN ANYDATA) IS
    lcr SYS.LCR$_ROW_RECORD;
    rc PLS_INTEGER;
    command VARCHAR2(30);
    old_values SYS.LCR$_ROW_LIST;
    old_pk_val sys.anydata;
    new_values SYS.LCR$_ROW_LIST := NULL;
    BEGIN
    rc := in_any.GETOBJECT(lcr);
    command := lcr.GET_COMMAND_TYPE;
    old_values := lcr.GET_VALUES('old');
    new_values := lcr.GET_VALUES('new');
    IF command = 'UPDATE' THEN
    old_values := lcr.GET_VALUES('old','y');
    lcr.SET_VALUES('new', old_values);
    lcr.ADD_COLUMN('new', 'TIMESTAMP', ANYDATA.ConvertDate(SYSDATE));
    lcr.ADD_COLUMN('new', 'OPERATION', ANYDATA.Convertvarchar2('UPDATE'));
    lcr.SET_COMMAND_TYPE('INSERT');
    lcr.SET_OBJECT_NAME('CHANNELS_DML');
    ELSIF command = 'DELETE' THEN
    lcr.SET_COMMAND_TYPE('INSERT');
    lcr.SET_OBJECT_NAME('CHANNELS_DML');
    lcr.SET_VALUES('new', old_values);
    lcr.SET_VALUES('old', NULL);
    lcr.ADD_COLUMN('new', 'TIMESTAMP', ANYDATA.ConvertDate(SYSDATE));
    lcr.ADD_COLUMN('new', 'OPERATION', ANYDATA.Convertvarchar2('DELETE'));
    ELSE
    lcr.SET_COMMAND_TYPE('INSERT');
    lcr.SET_OBJECT_NAME('CHANNELS_DML');
    lcr.ADD_COLUMN('new', 'TIMESTAMP', ANYDATA.ConvertDate(SYSDATE));
    lcr.ADD_COLUMN('new', 'OPERATION', ANYDATA.Convertvarchar2('INSERT'));
    END IF;
    lcr.EXECUTE(true);
    END;
    ++++++++++++++++++++
    INSERT, DELETE are working fine. However, when it comes to UPDATE I encounter "ORA-23605: invalid value "" for STREAMS parameter command_type".
    Would appreciate, if you can point me to any missed steps!
    Both source, target tables have the pk and supplemental logging is enabled for all the source tbl columns. (BTW, is it mandatory to enable supplemental logging ?)
    Thanks,
    Sharas

    You need to put this statement into IF 'UPDATE'
    lcr.SET_VALUES('old', NULL);
    old values in case of INSERT should be NULL.
    You may want to use case instead of IF ELSEIF...
    You might also have problems with LOBS... LOBs are not covered by this code.

  • Trouble Setting Up DML Handler for Journaling

    Hi Pat,
    I am trying to setup a simple DML handler for journaling of a table and cannot get it to work. Configuration is as follows:
    Source table
    Target table - updated via basic replication setup, this works fine.
    Target table journal - This table looks just like the original with additional columns for meta data about the transaction (i.e. trans_time, trans_type, trans_id..etc). Note: Did not use nested table technology.
    The problem is in compiling the user procedure for the DML handler we get an error on the INSERT part of the code:
    PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got -
    The code is listed below and the error points to the usage of the lcr.GET_VALUE package regardless of the column.
    Can you tell me if this is a correct usage of that package/procedure? Can you provide any better examples of DML handlers,preferbly for journaling? I understand from another thread you may have a new set of doc coming out. Maybe that can help me?
    I have a WORD doc w/pics that can better articulate the situation if it will help. Any direction is truely appreciated.
    Best Regards,
    Tom
    P.S. Is Oracle consulting spun up on this technology? We are not adverse to having profesional help to reduce our spinup time.
    CREATE OR REPLACE PROCEDURE contact_point_journal_dml(in_any IN SYS.ANYDATA)
    IS
    lcr SYS.LCR$_ROW_RECORD;
    rc PLS_INTEGER;
    BEGIN
    -- Access the LCR
    rc := in_any.GETOBJECT(lcr);
    -- Insert information in the LCR into the contact_point_journal table
    INSERT INTO strmuser.contact_point_journal
    VALUES
    (lcr.GET_VALUE('NEW', 'CONTACT_POINT_ID'),
    lcr.GET_VALUE('NEW', 'EFFECTIVE_DT'),
    lcr.GET_VALUE('NEW', 'VERSION'),
    lcr.GET_VALUE('NEW', 'CREATED_BY'),
    lcr.GET_VALUE('NEW', 'CREATED_TS'),
    lcr.GET_VALUE('NEW', 'CONTACT_CODE_ID'),
    lcr.GET_VALUE('NEW', 'ADDRESS1'),
    lcr.GET_VALUE('NEW', 'ADDRESS2'),
    lcr.GET_VALUE('NEW', 'ADDRESS3'),
    lcr.GET_VALUE('NEW', 'ADDRESS4'),
    lcr.GET_VALUE('NEW', 'CITY'),
    lcr.GET_VALUE('NEW', 'COUNTY'),
    lcr.GET_VALUE('NEW', 'STATE_PROVINCE_CODE_ID'),
    lcr.GET_VALUE('NEW', 'POSTAL_CODE'),
    lcr.GET_VALUE('NEW', 'COUNTRY_CODE_ID'),
    lcr.GET_VALUE('NEW', 'GEO_CODE'),
    lcr.GET_VALUE('NEW', 'OTHER_CONTACT_POINT_VALUE'),
    lcr.GET_VALUE('NEW', 'EXPIRATION_DT'),
    lcr.GET_VALUE('NEW', 'LAST_MODIFIED_BY'),
    lcr.GET_VALUE('NEW', 'LAST_MODIFIED_TS'),
    SYSDATE,
    lcr.GET_COMMAND_TYPE(),
    lcr.GET_TRANSACTION_ID(),
    lcr.GET_SCN(),
    lcr.GET_SOURCE_DATABASE_NAME(),
    lcr.GET_OBJECT_OWNER(),
    lcr.GET_OBJECT_NAME(),
    '1',
    'A'
    -- Apply row LCR
    -- Command type code may be '03' instead of 'insert' ???
    -- Is the syntax correct for SET statement ???
    lcr.SET_COMMAND_TYPE('INSERT');
    lcr.EXECUTE(true);
    END;

    Hi Tom,
    The GET_VALUE method of an LCR$ROW_RECORD returns a SYS.ANYDATA type.
    You need to specify one of the static access functions to get the value of the correct type.
    Here is your dml_handler with the modifications:
    CREATE OR REPLACE PROCEDURE contact_point_journal_dml(in_any IN SYS.ANYDATA)
    IS
    lcr SYS.LCR$_ROW_RECORD;
    rc PLS_INTEGER;
    BEGIN
    -- Access the LCR
    rc := in_any.GETOBJECT(lcr);
    -- Insert information in the LCR into the contact_point_journal table
    INSERT INTO strmuser.contact_point_journal
    VALUES
    (lcr.GET_VALUE('NEW', 'CONTACT_POINT_ID').AccessNumber(),
    lcr.GET_VALUE('NEW', 'EFFECTIVE_DT').AccessDate(),
    lcr.GET_VALUE('NEW', 'VERSION').AccessNumber(),
    lcr.GET_VALUE('NEW', 'CREATED_BY').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'CREATED_TS').AccessTimestamp(),
    lcr.GET_VALUE('NEW', 'CONTACT_CODE_ID').AccessNumber(),
    lcr.GET_VALUE('NEW', 'ADDRESS1').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'ADDRESS2').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'ADDRESS3').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'ADDRESS4').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'CITY').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'COUNTY').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'STATE_PROVINCE_CODE_ID').AccessNumber(),
    lcr.GET_VALUE('NEW', 'POSTAL_CODE').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'COUNTRY_CODE_ID').AccessNumber(),
    lcr.GET_VALUE('NEW', 'GEO_CODE').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'OTHER_CONTACT_POINT_VALUE').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'EXPIRATION_DT').AccessDate(),
    lcr.GET_VALUE('NEW', 'LAST_MODIFIED_BY').AccessVarchar2(),
    lcr.GET_VALUE('NEW', 'LAST_MODIFIED_TS').AccessTimestamp(),
    SYSDATE,
    lcr.GET_COMMAND_TYPE(),
    lcr.GET_TRANSACTION_ID(),
    lcr.GET_SCN(),
    lcr.GET_SOURCE_DATABASE_NAME(),
    lcr.GET_OBJECT_OWNER(),
    lcr.GET_OBJECT_NAME(),
    '1',
    'A'
    -- Apply row LCR, too
    lcr.EXECUTE(true);
    END;

  • [SOLVED] "No codec present that can handle the stream's type" issue

    Hello. I got a python program that would play musics on a website, which doesn't work for a "no codec present that can handle the stream's type" issue. I have installed things like gstreamer, gstreamer-plugins, gstreamer-python, gstreamer-ffmpeg, and libmpeg2, etc. However, this issue still remains. Would someone here be able to help?
    Here's the error message:
    ** Message: don't know how to handle audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)2, layer=(int)3, rate=(int)24000, channels=(int)2, parsed=(boolean)true
    Error: There is no codec present that can handle the stream's type. gstplaybasebin.c(2322): prepare_output (): /GstPlayBin:player
    Here's the program, written by a Chinese: https://github.com/zhendi/DoubanFM-CLI
    Edit:
    I'm able to play the musics on the websites via chromium.
    Edit:
    I tried to download the music, and use gst-launch-0.10 filesrc location=~/p535960.mp3 ! decodebin ! autovideosink, but only find these messages:
    Setting pipeline to PAUSED ...
    Pipeline is PREROLLING ...
    ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegAudioParse:mpegaudioparse0: GStreamer encountered a general stream error.
    Additional debug info:
    gstbaseparse.c(2695): gst_base_parse_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegAudioParse:mpegaudioparse0:
    streaming stopped, reason not-linked
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to NULL ...
    Freeing pipeline ...
    Last edited by lastland (2012-02-18 07:47:47)

    Sorry. I just found the reason. I missed gstreamer-ugly in this case.

  • How to update a column value by comparing old value by using DML Handler...

    Hi Can anyone post the DML Handler code for updating a column value by comparing the old value.
    Thanks,
    Ray

    Hi,
    Here is an example of a DML handler.
    BEGIN
    DBMS_APPLY_ADM.SET_DML_HANDLER(
    object_name => 'scott.emp',
    object_type => 'TABLE',
    operation_name => 'UPDATE',
    error_handler => false,
    user_procedure => 'strmadmin.update_column',
    apply_database_link => NULL,
    apply_name => 'MY_APPLY');
    END;
    This DML handler which will send any LCR matching the specified conditions to the strmadmin.update_column for customised processing.
    You can write the strmadmin.update_column procedure so that it extracts the old values from the LCR. You can then use the old values from the LCR to identify the row in the table. Once you identify the row, you can update it as you want.
    I haven't really tried to do any customised processing using DML handlers, but this should work.
    Hope this is of help.
    Sujoy

  • How to handle multiple streams

    Hi
    I wanted to handle multiple source Streams with Player. do i need to create a each player for each Stream ?? how can i do that ??
    Thanks in Advance,
    Karthikeyan R

    It's not at all obvious what a SequenceOutputStream would do. The way to write lots of stuff over a socket is to wrap multiple output streams round sock.getOutputStream and flush each one when you've finished with it. (There may be issues with compressed / bit output streams).

  • Handling Audio streams accross a network

    Hi,
    I have written a Computer Telephony Interface package for a SIP based PBX system and I'm currently exploring the possibility of turning it into a fully functional SIP softphone. The program has a basic SIP stack which I have extended to include the call setup messages, I just need some advice in how I can handle RTP properly.
    The PBX uses G.711 A-law audio codec and I have noticed that the JMF doesn't support type 8 RTP for A-law.
    Here is the scenario, a call comes into the program over the network using a standard Datagram socket, when my program answers the call I can see a load of bytes fired into my system every 20ms (160 bytes audio), I need a solution to convert those bytes into an audio stream and play them through my computer speakers.
    Can anyone give me any guidance on this?
    Thanks
    Brett

    I'm currently doing something similar, and I think this explains a lot
    http://java.sun.com/developer/JDCTechTips/2002/tt0319.html#tip1
    atleast how to play those data bytes as audio and how to do some
    encodings.
    If you're using datagram socket, the packets come in in a random order,
    so doesn't your audio sound a bit weird? Unless you have some mechanism
    to put the packets in correct order.
    kari-matti

  • Error while fetching lcr.get_logon_user in dml handler.

    Hi all,
    beacuse of lcr.get_logon_user am getting error in executing this procedure.
    CREATE OR REPLACE PROCEDURE history_dml(in_any IN SYS.ANYDATA) 
    IS
      lcr   SYS.LCR$_ROW_RECORD;
      rc    PLS_INTEGER;
    BEGIN
      -- Access the LCR
      rc := in_any.GETOBJECT(lcr);
      -- Insert information about the LCR into the history_row_lcrs table
      INSERT INTO strmadmin.history_row_lcrs VALUES
       (SYSDATE, lcr.GET_SOURCE_DATABASE_NAME(), lcr.GET_COMMAND_TYPE(),  
        lcr.GET_OBJECT_OWNER(), lcr.GET_OBJECT_NAME(), lcr.GET_TAG(),
        lcr.GET_TRANSACTION_ID(), lcr.GET_SCN(), lcr.GET_COMMIT_SCN,
        lcr.GET_VALUES('old'), lcr.GET_VALUES('new', 'n'),lcr.GET_LOGON_USER() );
      --  Apply row LCR
      lcr.EXECUTE(true);
    END;I need the "logon user" also in my log table while doing the dml, but when i add "lcr.GET_LOGON_USER() " into my procedure, it gives me an error saying "PLS-00302: component 'GET_LOGON_USER' must be declared".
    Please help.
    Kapil

    Hi Kapil,
    There are two types of stream objects..
    1.SYS.LCR$_DDL_RECORD
    2.SYS.LCR$_ROW_RECORD
    Summary of LCR$_ROW_RECORD Subprograms     
    Subprogram     Description
    "GET_COMMAND_TYPE Member Function"     Returns the command type of the LCR
    "GET_OBJECT_NAME Member Function"     Returns the name of the object that is changed by the LCR
    "GET_OBJECT_OWNER Member Function"     Returns the owner of the object that is changed by the LCR
    "GET_SCN Member Function"     Returns the system change number (SCN) of the LCR
    "GET_SOURCE_DATABASE_NAME Member Function"     Returns the source database name.
    "GET_TAG Member Function"     Returns the tag for the LCR
    "GET_TRANSACTION_ID Member Function"     Returns the transaction identifier of the LCR
    "IS_NULL_TAG Member Function"     Returns Y if the tag for the LCR is NULL, or returns N if the tag for the LCR is not NULL
    "SET_COMMAND_TYPE Member Procedure"     Sets the command type
    "SET_OBJECT_NAME Member Procedure"     Sets the name of the object that is changed by the LCR
    "SET_OBJECT_OWNER Member Procedure"     Sets the owner of the object that is changed by the LCR
    "SET_SOURCE_DATABASE_NAME Member Procedure"     Sets the source database name of the object that is changed by the LCR
    "SET_TAG Member Procedure"     Sets the tag for the LCR
    Summary of LCR$_DDL_RECORD Subprograms     
    Subprogram     Description
    "EXECUTE Member Procedure"     Executes the LCR under the security domain of the current user
    "GET_BASE_TABLE_NAME Member Function"     Returns the base (dependent) table name
    "GET_BASE_TABLE_OWNER Member Function"     Returns the base (dependent) table owner
    "GET_CURRENT_SCHEMA Member Function"     Returns the default schema (user) name
    "GET_DDL_TEXT Member Procedure"     Gets the DDL text in a CLOB
    "GET_LOGON_USER Member Function"     Returns the logon user name
    "GET_OBJECT_TYPE Member Function"     Returns the type of the object involved for the DDL
    "SET_BASE_TABLE_NAME Member Procedure"     Sets the base (dependent) table name
    "SET_BASE_TABLE_OWNER Member Procedure"     Sets the base (dependent) table owner
    "SET_CURRENT_SCHEMA Member Procedure"     Sets the default schema (user) name
    "SET_DDL_TEXT Member Procedure"     Sets the DDL text
    "SET_LOGON_USER Member Procedure"     Sets the logon user name
    "SET_OBJECT_TYPE Member Procedure"     Sets the object typeYou are refering wrong object for your get function.
    Thanks...

  • Adobe Connect server having difficulty handling multiple streams?

    Hello,
    We have some users that are having problems playing Adobe Presenter files that they have uploaded Connect (we run 7.5). The customers (teachers) say they use the files for online courses and get reports from students that sometimes the modules go into buffering and never get out of it. Is this a capacity issue? If yes, what are the options for how to deal with it? Thank you.

    The server shouldn't have issues with streaming multiple Presenter courses. Each server is designed to handle upto 500 concurrent connections, so if you have more than 500 students trying to access the presentation at the same time, you will likely see issues. If that is not the case, then you may have a firewall issue or something else causing the issue. Do you have any Anti-virus runing on the Server? Have you looked at the Logs to see if there is any insight there as to what happened?

  • I am new to this. How do I get OSMF player to handle RTMP streams? It's not in the docs.

    Hello all,
    I want to stream RTMP or RTMPE using the OSMF player on my website and although the using_fmp_smp_post1.0.pdf file SAYS this player can be configured for RTMP, NOWHERE in this file does it say HOW to do so. Keep in mind, not all of us are software engineers. Some of us save every penny to buy software like FMIS (which I did) and I want to use OSMF player to deliver the goods.
    So...
    Tell us HOW to deliver the goods vis RTMP!!!
    Please.
    Cheers,
    wordman

    WriterDonna,
    Thank you for listening! As a tech writer myself, I am always finding places in documentation that miss some crucial point. I respect the fact that OSMF is in pre-release stage and I am grateful for all the work required to get such a project off the ground.
    All I ask, and what I believe should always be included in documentation is this: If you mention a feature, address it and explain it. That simple. For example, the page regarding the player's installation in one's htdocs folder on their web server is concise, but it's also too little. It tells us how to check that the installation works by playing the sample video, but it offers NOTHING about how to troubleshoot the installation if the sample does not play.
    Please keep in mind that not everyone is a software engineer and there are people out there who are struggling along to not only learn a new technology, but are also having to implement it, almost simultaneously, as well. I appreciate that ideally, we'd all read tutorials, take classes and get up to speed FIRST. But as a one-man developer shop, I often have to learn and implement simultaneously. I have no choice. (I did so with PHP and MySQL).
    If your documentation can be technically concise while speaking in a tone that is understandable to people of modest skill levels (this is where the REOPS docs fail miserably) then, in my opinion, you will have succeeded. In turn, the users will be empowered and become your greatest champions.
    Again, thank you for listening!
    Sincerely,
    wordman

  • Best way to handle "heavy" streams?

    I apologise for the vague title.
    As a personal project, I am implementing a SOCKS5 server. As you might be aware, SOCKS5 is a simple binary protocol that wraps underlying data streams. I am using InputStream/OutputStream asynchronously for relaying the underlying data (Thanks to the advice I've received earlier on this forum - http://forum.java.sun.com/thread.jspa?threadID=5269807 )
    However I have some design and optimization related inquiries:
    1)
    I am using the read() and write() methods of InputStream/OutputStream respectively. Would it be better if I used read(buf,offset,len) and write(buf,offset,len) ? If so, on what basis do I determine the size of the buffer array?
    2)
    Would it be better if I use BufferedInputStream and BufferedOutputStream instead? Why?
    Assuming I use them, should I use the unbuffered read() and write() methods, or the buffered versions?
    3)
    Most important point... someone suggested to me that I should take a whole new approach for my project. Instead of dealing with Streams and Threads... I should use nio.SockerChannel and ByteBuffer for my project. I have never used these before, and I am still trying to grasp their documentation. I was told that NIO classes are more efficient than Streams, and they are even more suitable for me since I am relaying continuous data asynchronously. Any opinions?

    GizmoC wrote:
    On the basis that you know what the extra parameter values are. For read(), you usually don't need the extra params. For write(), you usually do,, as you usually want to write out the number of bytes you actually received.I am not really sure what you mean by "parameters". The parameters for the read() method - nothing to do with your protocol.
    Once again, let me remind you that I am working with SOCKS... maybe my understanding is wrong but SOCKS is nothing but a wrapper protocol for the underlying stream. In other words, I have no way of knowing what the underlying stream is - infact, I am not even supposed to care; as a SOCKS server my job is to merely forward the data to the remote host. Having said that, how am I supposed to determine the size of my buffer if I don't know what kind of data I am receiving.. I could be receiving anything from HTTP packets to Game packets.
    A proxy server usually doesn't need to read a byte at a time ... just read and write whatever is there. So in this case the buffered streams don't add much if anything.Yes, it doesn't make sense for a proxy server to read 1 byte at a time, how exactly do I "read and write whatever is there" ?Are you referring to the read(byte[] b) method?Since I am acting as a proxy for ejb - yes. You provide a byte[] as a buffer and the read() method returns the number of bytes actually read.
    >
    You aren't relaying data asynchronously if you're using java.net
    Yes I am, in fact, you suggested I should do it and it has worked for me. http://forum.java.sun.com/thread.jspa?threadID=5269807Let me show you how I am doing it...
    //Send data from Socks client to remote host
    new Thread( new Runnable()
    public void run()
    while( (buffer = is.read()) != -1 )
    unwrapped_os.write( buffer );
    }).start();
    //Receive data from remote host and send to Socks client
    new Thread( new Runnable()
    public void run()
    while( (buffer = unwrapped_is.read()) != -1 )
    os.write( buffer );
    }).start();
    That code does not look right. More on the lines of -
    byte[] buffer = new byte[4096]; // or whatever size you want
    for (int bytesRead = 0; (bytesRead = unwrapped_is.read(buffer)) != -1;)
        os.write(buffer, 0, bytesRead);
    }

Maybe you are looking for

  • Send all line items of a sales order to IPC along with condition lines data

    We wrote some pricing routines in R/3, where while doing he calculations for condition line item, we needed to pull in the material information for previous line items. So we exported vbap and imported it inside the routine to be able to have access

  • JNI with GCC

    I use java1.4.2_01 on a win98 (don't ask) machine. I am trying to run an "hello world" app with the method in C. The code is identical to that given here, http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html. My code works, if the

  • 8330 and duplicate calendar entries

    For some reason I am getting duplicate calendar entries (of the same event) from multiple email addresses.  How to I stop this?  I'm using Google sync (working fine) but I get entries from my Hotmail, another local ISP and Juno.  And Juno doesn't off

  • Transitions is messed up the first time it runs

    In the following code when the need to register button is pressed the transitions is messed up the first time it runs <?xml version="1.0" ?> <!-- transitions\LoginFormTransition.mxml --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"        

  • UX2 with garageband

    I just purchased a Line6 POD UX2, but unfortunately im having trouble installing the Pod farm, I really need to use it soon so I'm wondering if it is possible to plug my guitar into the Pod UX2 and then to my mac and record using only garageband with