Trigger on a tbl w/horizontal col delimted, need to upd/ins/del a vert tbl

I have a Table_A with 3 colon delimited columns with different fixed lengths. When an update, Insert or delete happens, To keep it simple, updates and inserts are treated the same, I need to Insert or delete a verticle table (Table_B) with the data. The data is loaded to Table_A as delimited
Table_A
columns apples will have 9 quantities, oranges will have 5 and pears 3
company     apples          oranges          pears
ABC     1:2:3:4:5:6:7:8:9     1:2:3:4:5          1:2:3
Table_B
company     qy_tp     qy
ABC     apples     1
ABC     apples     2
ABC     apples     3
ABC     .
ABC     .
.     apples 9
.     oranges     1
.     oranges     2
.     oranges     3
.     .     4
.     .     5
.     pears     1
.     pears     2
ABC     pears     3
Thanks in advance
Steve

SQL> create table table_a(company varchar2(10), apples varchar2(100));
Table created.
SQL> create table table_b(company varchar2(10), qy_tp varchar2(10), qy int);
Table created.
SQL> create trigger table_a$trg
SQL>   after insert or update or delete on table_a for each row
SQL> begin
SQL>   if :new.apples || ':' <> :old.apples || ':' then
SQL>     delete table_b where (company, qy_tp, qy) in
SQL>       ( select nvl(:old.company, :new.company), 'apples',
SQL>             to_number(substr(s, instr(s, ':', 1, level) + 1, instr(s, ':', 1, level + 1) - instr(s, ':', 1, level) - 1))
SQL>           from (select '::' || :old.apples || ':' as s from dual)
SQL>           where level > 1
SQL>           connect by level < length(s) - length(replace(s, ':'))
SQL>       );
SQL>     insert into table_b(company, qy_tp, qy)
SQL>       ( select nvl(:old.company, :new.company), 'apples',
SQL>             to_number(substr(s, instr(s, ':', 1, level) + 1, instr(s, ':', 1, level + 1) - instr(s, ':', 1, level) - 1))
SQL>           from (select '::' || :new.apples || ':' as s from dual)
SQL>           where level > 1
SQL>           connect by level < length(s) - length(replace(s, ':'))
SQL>       );
SQL>   end if;
SQL> end;
SQL> /
Trigger created.
SQL> insert into table_a values('ABC', '1:2:3:4:5:6:7:8:9');
1 row created.
SQL> select * from table_b;
COMPANY    QY_TP                 QY
ABC        apples                 1
ABC        apples                 2
ABC        apples                 3
ABC        apples                 4
ABC        apples                 5
ABC        apples                 6
ABC        apples                 7
ABC        apples                 8
ABC        apples                 9
9 rows selected.
SQL> update table_a set apples = '1:2:3:10:13';
1 row updated.
SQL> select * from table_b;
COMPANY    QY_TP                 QY
ABC        apples                 1
ABC        apples                 2
ABC        apples                 3
ABC        apples                10
ABC        apples                13
5 rows selected.
SQL> delete table_a;
1 row deleted.
SQL> select * from table_b;
no rows selected
SQL>

Similar Messages

  • Trigger that makes concatenation rows into cols and inserts to another tab.

    Hi,
    I have a trigger to do. Let me explain you how everything looks like in my DB.
    TABLE A
    O_ID | NAME
    1 | A_Name1
    2 | A_Name2
    3 | A_Name3
    4 | A_Name4
    TABLE B
    O_ID | NAME | DATE
    1 | ATT_15 |2011-01-01
    1 | ATT_16 |2011-01-02
    2 | ATT_15 |2011-03-03
    4 | ATT_19 |2011-03-05
    TABLE C (dictionary)
    P_ID | P_NAMEATTRIBUTE
    1 | P1
    2 | P2
    3 | P3
    4 | P4
    TABLE D
    O_ID | P_ID
    1 | 1
    1 | 2
    1 | 4
    2 | 3
    2 | 4
    4 | 2
    Basicly, all I'm trying to do is make a trigger based on:
    When you update Table A do an insert into Table B. What should be inserted?
    All ID’s from table C that matches trough TABLE D
    A.O_ID = D.O_ID and C.P_ID = D.P_ID but concatenated.
    I would like to have in this case inserted into table B records like that:
    O_ID | P_ID | P_NAMEATTRIBUTE
    1 | 1 2 | P1 P2 P4
    2 | 3 4 | P3 P4
    4 | 2 | P2
    Let's hope it's comprehensive. :)
    Regards!

    nodex wrote:
    I have tried to fire procedure from trigger. It works almost fine but there is always one row less than expected. I tried to reconfigure trigger in many ways but it didn't help.I meant show us an example your code with some data so we can see what you're doing.
    It's not really hard to concatenate rows into columns (wm_concat e.g.). It's hard to store it in a trigger.I wouldn't use wm_concat as it is an unsupported function, which can render your whole system unsupported by Oracle if the issue is found to be due to you using that. Also, Oracle can choose to change the functionality of that function in later versions if they want which could effect your expected output.
    In 10g or below, you should use sys_connect_by_path method to aggregate data. In 11gR2 there is the new LISTAGG analytical function.
    Saying "It's hard to store it in a trigger" doesn't tell us anything. Why is it hard? What problem are you experiencing?

  • JTable Horizontal Scroll WHEN NEEDED fix?

    Me again....
    JTable in a JScrollPane When the Jtable width exceeds the scrollpane I would like a horizontal scrollbar to appear. If the Jtable does not exceed the width Id like it to fill the ScrollPane.
    If I use the AUTO_RESIZE_OFF I get a horizontal scrollbar all the time. I dont want this if possible.
    I did try to overwrite getScrollableTracksViewportWidth() and getPreferredSize() as suggested by work around http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4127936
    However this bug is not exactly what I am having trouble with.
    Anyone know what I can do for this?
    Thanks
    B.

    You're welcome.
    Autoscrolling means that you can middle click on a web page and then get a scroll icon to indicate that you can move the mouse up or down to scroll the page automatically.

  • Trigger a WF when a Z table a record is INS/DEL/UPD.

    Hi Everyone,
    I have a requirememt where I want the Workflow to be triggered when ever a Record is Inserted/ Deleted /Modified.
    Can any one suggest me how should I achieve this task.
    Regasrds,
    Deepak.

    Hi Deepak,
    You can use various table level events for that.
    1) Go To table maintainance Generator-> Enviornment tab-> modifications-> events.
    2) Make a new entry click the first F4 it will give you a list of events for creating entry select event 05.
    3) Give a name and go to edit option.
    4) There you can call event SWE_EVENT_CREATE.
    5) Activate the Include and don't forget to activate the Function Group.
    6) Now create any entry and then you can see through transaction swel your event must be triggered.
    For any querry Plz let me know.
    Regards
    Manjari

  • Insert and update a data block which is based on view--urgent help required

    Hi experts,
    I created a view(A_VIEW) which is based on a union select. I have created a data block A_VIW_BLOCK which is based on this view. I need to insert/update one of the base tablesfor A_VIEW through this data block. I also need to be able to make a query through all the fields in the view.
    The questions are:
    1.Can it be done at all?
    2. What properties need to be set?
    3. If can't be done, what the best approach to achieve this?
    Thanks in advance!!
    Michael

    hi
    try something like this.
    CREATE TABLE demo_tab (
    person_id NUMBER(3),
    first_name VARCHAR2(20),
    last_name VARCHAR2(20));
    CREATE OR REPLACE VIEW upd_view AS
    SELECT * FROM demo_tab;
    INSERT INTO demo_tab
    (person_id, first_name, last_name)
    VALUES
    (1, 'Daniel', 'Morgan');
    INSERT INTO demo_tab
    (person_id, first_name, last_name)
    VALUES
    (2, 'Helen', 'Lofstrom');
    COMMIT;
    SELECT * FROM upd_view;
    UPDATE upd_view
    SET person_id = person_id * 10;
    SELECT * FROM upd_view;
    desc user_updatable_columns
    SELECT table_name, column_name, updatable, insertable, deletable
    FROM user_updatable_columns
    WHERE table_name IN (
       SELECT view_name
       FROM user_views);
    SQL> create table dummy (f1 number);
    Table created.
    SQL> create view dummy_v 
    2  as 
    3  select f1 from dummy 
    4  union all  
    5  select f1 from dummy;
    View created.
    SQL> create trigger dummy_v_it 
    2  instead of insert 
    3  on dummy_v 
    4  for each row 
    5  begin 
    6    insert into dummy values (:NEW.f1); 
    7  end; 
    8  /
    Trigger created.
    SQL> insert into dummy_v values (1);
    1 row created.
    SQL> select * from dummy_v;       
    F1
    1        
    1
    SQL> select *
      2  from user_updatable_columns
      3  where table_name = 'DUMMY_V';
    OWNER    TABLE_NAME   COLUMN_NAME  UPD INS DEL
    FORBESC  DUMMY_V      F1            NO  NO  NOforms settings.
    Enforce Primary Key - No
    Query Allowed - Yes
    Query datasource Name - V_TSFDETAIL
    Insert Allowed - Yes
    Update Allowed - Yes
    Delete Allowed - Yes
    Locking Mode - Automatic
    Key Mode - Automatic
    do not forget to create synonyms.
    hope this helps.
    sarah

  • HST60: qms$trans_errors.display_messages does not activate error window

    Using qms$trans_errors.display_messages; does not activate the error window. The window is popped but is not activated and no errors are shown. When activating the error window the errors are shown.
    Help needed.

    I have the same problem...
    My scenario is:
    I have a form with one block, a control block that collects data then from a when-button-pressed trigger on a button also on the control block, I call server-side code that updates tables (using the Tapi upd/ins/del procedures) but when a BR error occurs and returns to the form , the error block pops-up but is greyed out, only when I click on the block do the errors appears ok.
    NOTE: this only happens the first time the server code is run any subsequent times the error block displays fine.....
    code in ON-ERROR at form level:
    /* CGAP$TES_SEQUENCE_BEFORE */
    begin
    qms$event_form('ON-ERROR');
    end;
    code in ON-ERROR at block level:
    /* CGAP$OLES_SEQUENCE_BEFORE */
    begin
    qms$event_ctrl_block('ON-ERROR');
    end;
    I tried the sychronize and then moving to the block after the on-error code , but it made no difference.
    Regards David Short.

  • After insert trigger problem

    I am trying to write a trigger which will update a date col after every insert////
    CREATE OR REPLACE TRIGGER PS1.XX_CDATE
    AFTER INSERT ON ps1.COMMNPLANBUDGET
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    declare PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    update ps1.COMMNPLANBUDGET set CREATION_DATE=sysdate where PROJECTID = :new.PROJECTID;
    commit;
    END XX_CDATE;
    For the same i have written the above code, it created successfully but when i am inserting a record the date col is not getting updated. Please let me know where i have done wrong. Thanks in advance

    Hello
    You should not use autonomous transactions in a trigger. Do not do it, and if anyone tells you to use autonomous transactions in a trigger to avoid mutating table exceptiosn, you should instruct them to put their hands in a toaster, switch it on maximum and insist they keep them there until the timer reaches zero.
    Anyway, if the primary key on this table is project ID, you don't need to go to these lengths. You can simply
    CREATE OR REPLACE TRIGGER PS1.XX_CDATE
    BEFORE INSERT ON ps1.COMMNPLANBUDGET
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    BEGIN
        :NEW.creation_date := sysdate;
    END XX_CDATE;If project_id is not the primary key, why would you update the creation date for all rows attached to the project id?
    David
    Edited by: Bravid on Sep 22, 2011 9:29 AM
    Oops, after reading Karthik's post, I realised I left the AFTER insert in the trigger spec. Updated it to BEFORE.

  • One trigger for Multiple tables

    Hi all,
    I want write a trigger for mutiple tables.
    For Example,
    In database schema,some user update one table.I want to capture what the table and capture old value and new value.
    the above example for all insert and delete also.
    Regards
    Fame

    Hi, Fame,
    Sorry, a trigger only works on one table, so you need a separate trigger on each separate table.
    All of those triggers can call a common procedure.
    If you'd like to give a more detailed description of what you want to do, using two or three tables, then someone can give you more detailed instructions on how to do it.
    Always say which version of Oracle you're using.

  • Using an on update or insert trigger on a SAP table

    Hi all,
    A question for you regarding using a database trigger in and SAP system. 
    We are needing to export data for our datawarehouse.  Currently we export all the data.  That data is getting quite large tho and time is becoming an issue.
    One suggestion has been to add a custome field to an existing SAP table to hold a flag to indicate the record has changed but not been extracted.  Thenput a trigger on the table in question so that the new field is updated upon update or insert of the record.  Then when the extract runs, it will only extract those records with the flag set, then reset the flag.
    we are using ERP 6 and SQL Server 2005 (or soon to as we will be upgrading next month).
    Any suggestions regarding triggers?  Or other options for flagging changed records in large table so we don't have to extract all records every time?
    Thanks
    Laurie
    Edited by: Laurie McGinley on Oct 27, 2008 10:51 PM

    Hi Laurie,
    just really shouldn't consider to put triggers into your application.
    The problem here is the very nature of triggers to do things 'in the background'.
    If you have problems due to the trigger, you won't see it anywhere in the SAP environment.
    In a while you probably forget about the trigger at all and then nobody can see, what is happening to the database, just because something is changed "in the background".
    Besides that you don't get support for this from SAP, you will make your life a lot harder.
    Tabledefinitions may change - your trigger might break.
    Put application logic where it belongs - to the application layer!
    regards,
    Lars

  • :NEW cannot be used in After Delete Trigger ?

    Hi,
    Is there any way to get the :NW.value in the After delete trigger for each row. My requirement is audit log of the end user DML operations along with user Name (HERE THE USER IS NOT THE ORACLE USER, BECAUSE OF THE LARGE NUMBER OF END USERS WE ARE MAINTAINING ONE TABLE TO CREATE USER NAME & PASSWORD, WHEN THE USER LOGIN TO ORACLE FORM SCREEN, ASSIGN THE USER NAME TO GLOBAL VARIABLE) & Action Date.
    Here is my code for trigger - It is working fine with INSER & UPDATE but for DELETE User is NULL
    CREATE OR REPLACE TRIGGER Tgr_stud_det
    AFTER INSERT OR UPDATE OR DELETE ON student_details
    FOR EACH ROW
    DECLARE
    BEGIN
    IF Inserting THEN
    -------------INSERT VALUE---------------
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.NEXTVAL,
    :NEW.App_User,
    'INSERT',
    SYSDATE,
    :NEW.stud_name,
    :NEW.stud_age,
    :NEW.stud_sex);
    -------------DELETE VALUE---------------
    ELSIF Deleting THEN
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    Comment_Up,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.NEXTVAL,
    :OLD.App_User,
    'DELETE',
    SYSDATE,
    NULL,
    :OLD.stud_name,
    :OLD.stud_age,
    :OLD.stud_sex);
    ELSIF Updating THEN
    -------------UPDATE VALUE---------------
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    Comment_Up,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.NEXTVAL,
    :NEW.App_User,
    'UPDATE',
    SYSDATE,
    'NEW VALUE',
    :NEW.stud_name,
    :NEW.stud_age,
    :NEW.stud_sex);
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    Comment_Up,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.CURRVAL,
    :NEW.App_User,
    'UPDATE',
    SYSDATE,
    'OLD VALUE',
    :OLD.stud_name,
    :OLD.stud_age,
    :OLD.stud_sex);
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END Tgr_stud_det;
    Thanks in advance.

    Rizly,
    As i mentioned in the above post, you should remove the references of :old and :new when you are trying to use the global variables. These values are only significant when you the talk about the record in the table.
    For the scenario, you explained, your trigger would insert two records....The trigger would be fired twice.. once during the insert and once during the delete. The audit table will have two records indicating both the actions..
    Take a look at this example below...I am artificially manufacturing a user id in the package test_pkg and using that in the insert trigger. As i explained above, you dont need the :old and :new references because the user id is not a column in the table . hence the :old and :new references have no relevance.
    Also note that, for the delete, I use the :old value and for the insert, I use the :new value.
    for update, I assume you want to store the old record and hence used :old (you can of course use :new too..technically.).
    I don't have access to a forms environement, but the user id logic should be similar to what I described below.
    sql> create table t(
      2     id number,
      3     name varchar2(20)
      4  );
    Table created.
    sql> create table t_audit
      2     ( id number,
      3       name varchar2(20),
      4       action varchar2(20),
      5       user_id varchar2(20)
      6  );
    Table created.
    sql> create or replace package test_pkg as
      2      function get_user_id return varchar2;
      3  end test_pkg;
      4  /
    Package created.
    sql> create or replace package body test_pkg as
      2      function get_user_id return varchar2 is
      3      begin
      4          return 'USER' || to_char(sysdate,'HH24:MI');
      5      end get_user_id;
      6  end test_pkg;
      7  /
    Package body created.
      1  create or replace trigger trg_biud_t
      2     before insert or update or delete on t
      3     for each row
      4  begin
      5     if INSERTING then
      6        insert into t_audit values (:new.id, :new.name, 'INSERT',test_pkg.get_user_i
      7     elsif UPDATING then
      8        insert into t_audit values (:old.id, :old.name, 'UPDATE',test_pkg.get_user_i
      9     elsif DELETING then
    10        insert into t_audit values (:old.id, :old.name, 'DELETE',test_pkg.get_user_i
    11     end if;
    12* end;
    sql> /
    Trigger created.
    sql> select * from t;
    no rows selected
    sql> select * from t_audit;
    no rows selected
    sql> insert into t values (100, 'Rajesh');
    1 row created.
    sql> insert into t values (200,'Kumar');
    1 row created.
    sql> delete from t where id = 200;
    1 row deleted.
    sql> commit;
    Commit complete.
    sql> select * from t
      2  /
            ID NAME
           100 Rajesh
    sql> select * from t_audit;
            ID NAME                 ACTION               USER_ID
           100 Rajesh               INSERT               USER15:36
           200 Kumar                INSERT               USER15:36
           200 Kumar                DELETE               USER15:37

  • How to connect external trigger PCI-1433

    Hi all:
    I met the same problem as this old post: https://forums.ni.com/t5/Machine-Vision/How-to-connect-external-trigger-PCIe-1433/m-p/1677560/highli...
    however the post did not give solution.
    I am having an issue getting the external trigger( from PCI 6259) to work with a cameralink camera, a PCIe-1433 card . The PCI 6259 is connected to BNC 2111, the output trigger signal from CTR0 is connected to the SMB connector on the 1433 card and is providing pulse train at TTL voltages (0-5V).  Using the MAX SOFTWARE and under the Acquisition tab I have CC1 set to external 0, however the camera is not receiving this external trigger. The camera is Basler 4096-140km.
    I measured the ouiput signal from CTL0, the sigal seems good.
    I tried RTSI trigger before, failded. I thought SMB should be more straight forward, seems I was wrong.
    Looking forward to reply!
    Attachments:
    camera configuration.jpg ‏168 KB
    External Camera Trigger(SMB).vi ‏57 KB

    Bobjojo,
    You will actually need to affect the properties of both the camera and the frame grabber to take advantage of this triggering mode. I found a document that contains a good run down of the process to acquire in this mode (linked below). As far as the programming for the acquisition is concerned, the frames will be built at the driver level for the specified frame height. This means that the IMAQ driver will composite the line scans for you, and any simple acquisition (the document shows using the Vision Acquisition Express VI) will be able to pull the image into LabVIEW.
    www.ni.com/white-paper/13786/en/pdf
    Karl G.
    Applications Engineer
    ni.com/support

  • How do I flip the view of the legend bar so it is vertical instead of horizontal? I want the legend bar vertically positioned in my column chart.

    I clicked the show legend button and edited it according to my data but it placed it horizontally. I need it vertical and there does not seem to be a function to flip the view. Does anybody know how to switch the view of the legend bar?

    Use the handle at the left or right to the Legend box to reduce the width of the box. The strung-out list will change to columns, and eventually to a single column.
    Regards,
    Barry

  • Print insert result to a printer in TSQL trigger after insert - Need help.

    Hi,
    I am trying to print a record to a printer whenever a new record is inserted into a table called PrintTickets, using TSQL trigger for insert. 
    Is it possible to print a new inserted record to a printer?
    Here is the trigger tsql statement: 
    ALTER TRIGGER [dbo].[PrintDeal]
    ON [dbo].[PrintTickets]
    AFTER INSERT
    AS
    declare @Id numeric(18,0)
    ,@DealId char(15)
    ,@ValueDatePeriod1Currency1 datetime
    ,@Bank1Name char(56)
    ,@Currency1 char(3)
    ,@Currency2 char(3)
    ,@PaymentInstructionP1C1 char(80)
    ,@DealerId char(6)
    ,@DealVolumeCurrency1 float
    ,@CalVolumeP1C2 float
    ,@ExchangeRatePeriod1 float
    declare @tmp table
    Id numeric(18,0)
    ,DealId char(15)
    ,ValueDatePeriod1Currency1 datetime
    ,Bank1Name char(56)
    ,Currency1 char(3)
    ,Currency2 char(3)
    ,PaymentInstructionP1C1 char(80)
    ,DealerId char(6)
    ,DealVolumeCurrency1 float
    ,CalVolumeP1C2 float
    ,ExchangeRatePeriod1 float
    PRIMARY KEY (Id)
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for trigger here
    insert @tmp
    select
    Id
    , DealId
    , ValueDatePeriod1Currency1
    , Bank1Name
    , Currency1
    , Currency2
    , PaymentInstructionP1C1
    , DealerId
    , DealVolumeCurrency1
    , CalVolumeP1C2
    , ExchangeRatePeriod1
    FROM dbo.PrintTickets
    WHERE ID=@@IDENTITY
    select @Id=Id
    ,@DealId=DealId
    ,@ValueDatePeriod1Currency1=ValueDatePeriod1Currency1
    ,@Bank1Name=Bank1Name
    ,@Currency1=Currency1
    ,@Currency2=Currency2
    ,@PaymentInstructionP1C1=PaymentInstructionP1C1
    ,@DealerId=DealerId
    ,@DealVolumeCurrency1=DealVolumeCurrency1
    ,@CalVolumeP1C2=CalVolumeP1C2
    ,@ExchangeRatePeriod1=ExchangeRatePeriod1
    from @tmp
    -- Code to print to a physical printer if possible
    END
    The table is called PrintTickets and it contains the following columns: 
    Id numeric(18,0)
    ,DealId char(15)
    ,ValueDatePeriod1Currency1 datetime
    ,Bank1Name char(56)
    ,Currency1 char(3)
    ,Currency2 char(3)
    ,PaymentInstructionP1C1 char(80)
    ,DealerId char(6)
    ,DealVolumeCurrency1 float
    ,CalVolumeP1C2 float
    ,ExchangeRatePeriod1 float
    PRIMARY KEY (Id)
    The dummy records that I am inserting for testing the results in csv format:
    Id,DealId,ValueDatePeriod1Currency1,Bank1Name,Currency1,Currency2,PaymentInstructionP1C1,DealerId,DealVolumeCurrency1,CalVolumeP1C2,ExchangeRatePeriod1
    696,XXX#33111 ,2014-03-04 00:00:00.000,HSBC ,USD,EUR,XXXXXXXXXXXXXXXXXXXXXXX ,MAT ,342342,87987,0.3123
    697,XXX#33113 ,2014-03-04 00:00:00.000,USB ,EUR,USD,9999999999999999999999,ZXY,2334243,32213,0.3245
    698,XXX#33114 ,2014-03-03 00:00:00.000,SWISS BANK ,CHF,USD,99999999999999900000,XYZ ,32423424,342,0.83432
    699,XXX#33115 ,2014-03-03 00:00:00.000,UK BANK ,USD,PND,XXXXXXXXXXXXXXXXXXXXXXX ,ABC,9809808,0,0.0349
    700,XXX#33116 ,2014-03-04 00:00:00.000,USCF BANK ,XXX,XXX,XXXXXXXXXXXXXXXXXXXXXXX ,ABC,89798797,756756,0.734
    I appreciate any help.
    Thanks in advance.

    Is it possible to print a new inserted record to a printer?
    From SQL Server?
    The task of SQL Server is to manage large of data effciently. It is not a general programming environment. It could possibly be done with a CLR procedure that that talks to the printer, but it is not the correct solution.
    A possible design could be to post a message on a Service Broker queue, and then the printing server would poll the queue and print the ticket.
    By the way, there are more flaws in your trigger. To find the inserted rows, you need to query the virtual table "inserted" which holds a copy of these rows. Furthermore, since a trigger fires once per statement, the trigger must handle the fact
    that multiple rows are inserted.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Horizontal scroll bar is in JTable

    I am doing following code to set horizontal and vertical scroll bar to Table. vertical is working nicely but horizontal is not added to table and all colum of table got shrink and hardly visible. so i want to set horizontal scrollbar as needed.
    how can that possible. looking for response
    mTable.setPreferredScrollableViewportSize(new Dimension(TABLE_WIDTH, TABLE_HEIGHT));
    mTable.setRowHeight(TABLE_ROW, TABLE_ROWHEIGHT);
    mTable.getTableHeader().setResizingAllowed(false);
    mTable.setGridColor(Color.darkGray);
    mTable.getTableHeader().setReorderingAllowed(false);
    mScrollPane = new JScrollPane(mTable);
    mScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    mScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    Message was edited by:
    Prashant_SDN

    that looks odd. what is wrong in this case
    Nothing's wrong. The columns all start up with the same default width.
    If you want it fitted to width on being shown and then become adjustable then you should invoke that change in a listener which executes when the component is shown (the reliable way to do this is use a HierarchyListener which checks isShowing() and then executes if that's true, then deregisters itself).

  • How to append a file in a trigger?

    I'm writing from a table to a file, and have created a trigger that works great...however, I need to append the file so it doesn't overwrite the file every time the trigger fires.
    Here's the code...but I can't figure out how to append the file instead of just write to the file:
    CREATE OR REPLACE TRIGGER checkout_trg
    AFTER UPDATE OF movie_qty ON mm_movie
    FOR EACH ROW
    DECLARE
    fh UTL_FILE.FILE_TYPE;
    BEGIN
    IF :NEW.movie_qty=0 THEN
      fh:=UTL_FILE.FOPEN('ORA_FILES','chekcout.txt','w');
      UTL_FILE.PUT_LINE(fh, 'Date: '||sysdate||', Movie ID: '||:NEW.movie_id||', Quantity: '||:NEW.movie_qty);
      UTL_FILE.FCLOSE(fh);
    END IF;
    END;
    /

    > It's for an assignment...I think thye're just trying to show us what's possible.
    Just as it is possible to show a learner driver to jump a red light, drive on the wrong side of the road, or do doughnuts in an intersection...
    But none of this will make that learner driver a good driver. Never mind able to correctly handle high performance cars on the professional circuit.
    Sorry mate - what they are showing/teaching you is pure bs. A trigger is not the "same thing" as a callback event in client programming.
    And feel free to give them this URL and tell them that I think they are full of it. Let's see how they defend their non-real world, totally irrelevant and wrong assignments in this very forum.

Maybe you are looking for

  • I killed a MacBook Pro. Shutdown with flash in drive and now it won't start at all.

    I may have killed my MacBook Pro OS X by accidentally restarting  with  a Flash Drive it it and now it won't start at all.  Any ideas?

  • Strorage location is initial in  Inventory movements cube 0IC_C03.

    Hi -       I  have a requirement  to show total inventory value by Storage locations for selected dates. I have activated business content and loaded data into Infocube as per how to document.... But 0STOCTYP, 0STOR_LOC and 0BATCH are not filling in

  • Stupid question #21 or #22

    There are certain "processes" that are triggered in System 10.4.7 (soon to be 10.4.8), such as fan starting when certain conditions are met, ie: high temperature. Are these same processes triggered when the computer is running Windows under Parallels

  • Change of General Ledger Account in MIRO transaction

    Hi all. I have to post a invoice in MIRO transaction, and, if Account Assignment Category (KNTTP) is = 'A', I have to substitute General Account by other. I have tried do it by GGB1, but here field BKPF-BELNR and BKPF-AWKEY aren't filled, and I don't

  • Question about the Ni-DAQ function used in VB

    thanks for the previous answer first! I found that my computer has not installed the Measurement Stduio. When i wanna add module with file nidaq.bas, it shows nothing. Therefore, i download this file and nidaqcns.inc file from the web. Then i add the