Commit in procedures

hi,
i have written one procedure which contains only insert and update statements which are coming from front end.
after insert/update the records into table wether i need to write commit in my procure or commit is done from front end itself ie commiting the transaction.

jeneesh wrote:
I did not say, DB is crashed..
I do say about APPLICATION..Still don't know what difference that makes. If the application crashes, the user will be sitting there saying "thank God my work got saved before it crashed!" ;)
Assuming there is a 'front-end' application, it's still a case of "it depends", because it does depend on what the application is doing. Maybe the front end application kicks off an atomic process on the back end that, for example, updates all employees with this years "cost of living increase" for their salary. They push the button, it calls the procedure to do it. There's no reason the procedure cannot commit the transaction when it's complete, and no reason that the front end has to issue a commit afterwards, especially as the application itself has not been involved in any part of the transaction apart from initiating it through the procedure call. Conversely, if the application is inputting data and sending 'records' to the database to be inserted/updated/deleted, then you would likely have a commit on the "Save" button (or whatever) after it's sent all the data to be processed by the database, so yes, in that case you'd have a commit in the front end.
There is no strict answer of saying it should be in the front end or should be in the procedure. The only strict answer is that the commit should happen when the transaction has logically completed.

Similar Messages

  • Commit in procedure, function

    Hi
    all, I am confusing about "use of commit in procedure and function".How commit reflect to the performance ?
    Is there any error raises by frequent use? pls explain me.
    Thanks in advance
    sanjay

    Hi, when a user issues a COMMIT statment, LGWR puts a commit record in the redo log buffer and writes it to disk immediately, along with the transaction's redo entries. The corresponding changes to data blocks are deferred until it is more efficient to write it them. This is called a fast commit mechanism. The atomic write of the redo entry containing the transaction's commit record is the single event determines whether the transaction has commited. Oracle Database returns a sucess code to the committing transaction, although the data buffers have not yet been written to disk
    A commit have a cost, issue it only when you need confirm all the changes that you have been made since the last commit/rollback.

  • Commit in procedures after every 100000 records possible?

    Hi All,
    I am using an ODI procedure to insert data into a table.
    I checked that in the ODI procedure there is an option of selecting transaction and setting the commit option as 'Commit after every 1000 records'.
    Since the record count to be inserted is 38489152, I would like to know is this option configurable.
    Can i ensure that commits are made at a logical step of 100000 instead of 1000 records?
    Thank You.
    Prerna

    recently added on this
    http://dwteam.in/commit-interval-in-odi/
    Thanks
    Bhabani
    http://dwteam.in

  • Commit in procedure

    Gurus,
    Can you tell me whether can I give Commit in a procedure ? If yes how ? If no why ?
    Regards

    Yes you can by simply entering
    commit;
    Whether its wise to depends on the context of your procedure.
    Andre

  • Error message when issuing a COMMIT in a store procedure

    Hello experts,
    Please help.
    I have a problem where i cannot specify a COMMIT in a store
    procedure. I have the following error message:
    =================================================================
    00034, 00000, "cannot %s in current PL/SQL session"
    // *Cause:  An attempt was made to issue a commit or rollback
    from a PL/SQL
    // object (procedure, function, package) in a session
    which has this
    // disabled (by 'alter session disable commit in
    procedure')
    // *Action: enable commits from PL/SQL in this session, or don't
    attempt
    // to use commit or rollback in PL/SQL when they are
    disabled
    // in the current session.
    =================================================================
    Thanks very much for a reply
    Kind regards
    Yogeeraj

    The solution is to issue the statement
    alter session enable commit in procedure;
    However, I'd think carefully about doing this. Procedures are
    often called as part of a wider transaction. If the procedure
    issues a commit ALL the preceding work is also commited. If
    there is something subsequent in the transaction that fails and
    issues a rollback, it will onlt rollback the work done after the
    procedure. This may lead to your database being in an
    inconsistent state.
    rgds, APC

  • Commit or no commit statement in procedure

    Hi all,
    i have two version of the same procedure.
    procedure A
    --loop
    ---fetch into record
    --update a flag as processed
    commit;
    end loopprocedure A'
    -- loop
    --fetch into record
    --update a flag
    end loop In procedure A, i do a commit after every row. In A', i do not issue any commit statement. Will oracle auto commit the changes done in A' after the procedure finishes?
    Because i realise in procedure A, it takes a long time finish. Whereas in A' it takes a relatively less time to finish.
    Any harm if i choose procedure A' ?

    Any harm if i choose procedure A' ?No.
    But this way I prefer to commit.
    Commit inside the loop surely slow down the performance.
    If it is a huge table, then commit after every few set of trasactions will be advisable.
    Procedure A
    loop
    fetch into record....
    update or whatever your task....
    end loop;
    "commit";
    end procedure A.

  • Commit not allowed in Trigger  then how to store the values in table

    Hi,
    Database trigger not allowed to COMMIT in it (directly) or in procedure which is calling from the Trigger. it gives error.
    so my question is:-
    1)How Database internally store the INSERT AND UPDATE value in table which is written in procedure without COMMIT?
    2) Is it necessary to write COMMIT in procedure using PRAGAMA AUTONOMOUS TRANSACTION to store inserted or updated value in table?
    Thanks in advance.

    Hi,
    A trigger is designed to be a part of a transaction, not it's end.
    It is like following these steps (not really accurate, but should give an idea):
    1. programA issues INSERT statement on tableA
    2. 'control' goes over to the database
    3. constraint checks happen
    4. the associated triggers on tableA do their work (e.g. fetching a sequence value for a primary key)
    5. 'control' goes back to programA
    6. programA decides if a commit (no error occurred) or a rollback (error case) has to be issued.
    Did this help? Probably not, I'm not happy with what I wrote, but anyway... :)

  • Commit sequence in forms

    I have one block with single record
    and 3 others blocks with multiple records.
    block1
    b2
    b3
    b4
    On SAVE button when_button_pressed trigger
    Code is
    declare
    v_commit number:=0;
    begin
    p_insert_test(
    :block1.p_emp_id
    ,v_commit
    --Note : No commit inside procedure p_insert_test
    if v_commit = 0 then
    go_block('b1');
    commit_form;
    go_block('b2');
    commit_form;
    go_block('b2');
    commit_form;
    end if;
    end;
    problem
    1.After execution of procedure p_insert_test if some error occurs in block b1,b2
    or b3 then record is showing as inserted through above procedure for same session when I am doing query in same block.
    Please tell me the best way of commit sequence in above scenario to maintain
    the consistency.

    I agree with you that there is no need to commit_form after each block
    but how to revert insert through procedure p_insert if any error
    occurred in multiple blocks.
    Because I record inserted are visible in particular session.

  • Autocommit in Stored procedures

    Hi all!
    Can we set the autocommit variable in a stored procedure? if yes, how?
    regards,
    Rajat Aggarwal

    No. Autocommit can be turned OFF at the client or connection level, and that is the only thing you should do to it. It can be useful to set it ON when connecting to Microsoft SQL Server databases.
    Don't commit in stored procedures either, let the client commit the procedure changes, then you can write procedures that can be called together within a transaction.

  • Help: using a stored procedure to insert a record in DB

    A stored procedure:
    PROCEDURE db_insert
    db_block IN OUT plsql_table)
    is created in DB.
    db_select and db_update are created too. They both work fine as
    db_select is called by go_block execute_query (block populated) and
    db_update is called by commit (DB updated);
    I am trying to have db_insert called as:
    1. DO_KEY('Create_Record');
    2. fill in fields and then
    3. commit.
    These 3 steps do not cause the call of the auto generated block trigger insert_procedure. I think that after filling in the fields and there should be a way to call this insert_procedure trigger. I am not sure how this will work.
    Any suggestions are greatly appreciated.

    I went through quite a deep search and yet not found any good answers. Knowing that select and update all done well with execute_query(stored procedure is called) and commit(stored procedure is called), but not insert.
    Logically there must be some FORM build in that will trigger the call of stored procedure insert.
    I am still looking for answers and just to remind that there are quite number of similar posts and I do not think that any clear answers were delivered.
    Please help.

  • Table name change in procedure dynamically

    create table tab1(x number);
    create table dynamic_table (x number);
    insert into tab1 values (1);
    insert into dynamic_table values (1);
    commit;
    create procedure proc1
    is
    v_x number;
    begin
    execute immediate 'create table mytab
    as select tab1.*
    from tab1, tabc
    where tab1.x = dynamic_table.x';
    end;
    begin
    proc1;
    end;
    /dynamic_table --> should be dynamically replaced in the procedure
    There are two more tables in this scenario - tabe and tabf, In the above procedure, I have to dynamically replace dynamic_table first with tabe, call it, then then replace with tabf and execute procedure again
    Is there a way I can do that ? any dynamic sql that will prompt me to call proc1 twice, 1st time replace dynamic_table with tabe, then with tabf
    the structure of tabe and tabf is the same, I am currently passing a parameter to the procedure and replacing dynamic_table with the input parameter, and then
    calling the procedure twice by passing the table names, wanted to follow a better approach
    Currently, I am doing somethig like this:
    create procedure proc1 (i_param in varchar2)
    is
    v_x number;
    begin
    execute immediate 'create table mytab
    as select tab1.*
    from tab1, tabc
    where tab1.x = i_param.x';
    end;
    begin
    proc1('tabe');
    proc1('tabf');
    end;
    /

    Why are you trying to do this?
    Good database design practice means that you don't create tables dynamically within your code.
    Why do you have tables of the same structure with different names?
    Dynamic table names are not a good idea because it means all your code has to be dynamic.
    So whilst it's perfectly possible to do what you are asking, showing you how to do it would be like me showing you how to fly a plane into the ground, i.e. not something that's clever or wise.
    So, better you explain what problem you are trying to solve rather than ask us how to improve on the poor code you are already trying to do.

  • Calling procedures at runtime

    hi,
    if i call a procedure from forms runtime, and if the procedure is a little lengthy, then it takes a few minutes for running,
    can i do something to make my procedures to run faster.............
    thanks.

    Hi Sir,
    Oracle Database: 9i release 2
    Developer: 6i
    O/S: Windows Server 2003 Enterprise Edition
    Hardware specs: Dell precision 530, Intel Xeon 2.20 GHz, dual processor, 2 GB Ram.
    max of 30,000 characters. so sending some of the tables......
    Procedure:
    PROCEDURE UPD_FGS_STOCK(P_DATE1 DATE,P_DATE2 DATE)
    IS
    BEGIN
    --DELETE FROM FGS_STK;
    --COMMIT;
    --OPENINGS
    opening balances -----------------
    INSERT INTO FGS_STK(cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_bal)
    SELECT c.inf1,a.inf4,a.ref3,a.ref2,m.m_desc,a.item_id,SUM(a.qty)
    FROM FGS_STOCK_OPENING a,GL_COMPANIES c, MODELS m
    where a.inf4=c.company_id(+)
    and a.item_id=m.pm_id(+)
    and m.m_desc<>'TB'
    and tr_date<P_DATE1
    group by c.inf1,a.inf4,a.ref3,a.ref2,m.m_desc,a.item_id;
    opening receiving direct-------------------
    INSERT INTO FGS_STK(cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_rec)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.rec_dept_id=90
    and h.iss_dept_id=53
    and h.inf5='R'
    and i.tyre_tube<>'TB'
    AND h.tr_date<P_DATE1
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    opening receiving Return -------------------
    INSERT INTO FGS_STK(cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_rec_ret)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.rec_dept_id=90
    and h.iss_dept_id=53
    and h.inf5='C'
    and i.tyre_tube<>'TB'
    AND h.tr_date<P_DATE1
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    opening receiving REPACKING-------------------
    INSERT INTO FGS_STK(cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_rec_pack)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.rec_dept_id=90
    and h.iss_dept_id=53
    and h.inf5='P'
    and i.tyre_tube<>'TB'
    AND h.tr_date<P_DATE1
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    Opening issuance DIRECT ----------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_iss)
    (select c.inf1,h.buyer_id,c.inf2,m.m_desc_for_id,m.m_desc,i.ref_num,sum(i.deliver_qty)
    from dcd_temp i, dcm_temp h,gl_companies c,sticker s, models m, vehicles v
    where h.dc_id=i.dc_id
    AND h.dc_date<P_DATE1
    AND h.buyer_id=c.company_id(+)
    AND c.inf2=s.sticker_id(+)
    AND I.ref_num=M.pm_id(+)
    AND M.m_desc_for_id=v.vehicle_id(+)
    AND m.m_desc<>'TB'
    group by c.inf1,h.buyer_id,c.inf2,m.m_desc_for_id,m.m_desc,i.ref_num);
    -- Opening Issuance Transfer --------------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_iss_indirect)
    (SELECT c.inf1,a.iss_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id, sum(i.qty)
    FROM transfer_header a, transfer_lines i, gl_companies c, sticker s,models m, vehicles v
    WHERE i.tr_id=a.tr_id
    AND a.tr_date<P_DATE1
    AND a.iss_dept_id=c.company_id(+)
    AND c.inf2=s.sticker_id(+)
    AND i.item_id=m.pm_id(+)
    AND m.m_desc_for_id=v.vehicle_id(+)
    AND m.m_desc<>'TB'
    GROUP BY c.inf1,a.iss_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id);
    -- Opening Issuance Repacking --------------
    INSERT INTO FGS_STK(cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_iss_pack)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.iss_dept_id=90
    and h.rec_dept_id=53
    and h.inf5='P'
    and i.tyre_tube<>'TB'
    AND h.tr_date<P_DATE1
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    -- Opening Receiving Transfer
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_rec_indirect)
    (SELECT c.inf1,a.rec_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id, sum(i.qty)
    FROM transfer_header a, transfer_lines i, gl_companies c, sticker s,models m, vehicles v
    WHERE i.tr_id=a.tr_id
    AND a.tr_date<P_DATE1
    AND a.rec_dept_id=c.company_id(+)
    AND c.inf2=s.sticker_id(+)
    AND i.item_id=m.pm_id(+)
    AND m.m_desc_for_id=v.vehicle_id(+)
    AND m.m_desc<>'TB'
    GROUP BY c.inf1,a.rec_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id);
    --CURRENT
    current opng balances -----------------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, opng_bal)
    SELECT c.inf1,a.inf4,a.ref3,a.ref2,m.m_desc,a.item_id,SUM(a.qty)
    FROM FGS_STOCK_OPENING a,GL_COMPANIES c, MODELS m
    where a.inf4=c.company_id(+)
    and a.item_id=m.pm_id(+)
    and m.m_desc<>'TB'
    and tr_date BETWEEN P_DATE1 AND P_DATE2
    group by c.inf1,a.inf4,a.ref3,a.ref2,m.m_desc,a.item_id;
    current receiving direct (packing)--------------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, rec)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.rec_dept_id=90
    and h.iss_dept_id=53
    and h.inf5='R'
    and i.tyre_tube<>'TB'
    AND h.tr_date BETWEEN P_DATE1 AND P_DATE2
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    current receiving return from packing--------------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, rec_ret)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.rec_dept_id=90
    and h.iss_dept_id=53
    and h.inf5='C'
    and i.tyre_tube<>'TB'
    AND h.tr_date BETWEEN P_DATE1 AND P_DATE2
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    current receiving REPACKING--------------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, rec_pack)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.rec_dept_id=90
    and h.iss_dept_id=53
    and h.inf5='P'
    and i.tyre_tube<>'TB'
    AND h.tr_date BETWEEN P_DATE1 AND P_DATE2
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    current issuance DIRECT (dc)-------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, iss)
    (select c.inf1,h.buyer_id,c.inf2,m.m_desc_for_id,m.m_desc,i.ref_num,sum(i.deliver_qty)
    from dcd_temp i, dcm_temp h,gl_companies c,sticker s, models m, vehicles v
    where h.dc_id=i.dc_id
    AND h.dc_date BETWEEN P_DATE1 AND P_DATE2
    AND h.buyer_id=c.company_id(+)
    AND c.inf2=s.sticker_id(+)
    AND I.ref_num=M.pm_id(+)
    AND M.m_desc_for_id=v.vehicle_id(+)
    AND m.m_desc<>'TB'
    group by c.inf1,h.buyer_id,c.inf2,m.m_desc_for_id,m.m_desc,i.ref_num);
    current issuance Transfer -------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, iss_indirect)
    (SELECT c.inf1,a.iss_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id, sum(i.qty)
    FROM transfer_header a, transfer_lines i, gl_companies c, sticker s,models m, vehicles v
    WHERE i.tr_id=a.tr_id
    AND a.tr_date BETWEEN P_DATE1 AND P_DATE2
    AND a.iss_dept_id=c.company_id(+)
    AND c.inf2=s.sticker_id(+)
    AND i.item_id=m.pm_id(+)
    AND m.m_desc_for_id=v.vehicle_id(+)
    AND m.m_desc<>'TB'
    GROUP BY c.inf1,a.iss_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id);
    -- Current Issuance Packing --------------
    INSERT INTO FGS_STK(cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, iss_pack)
    (select h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id,sum(i.rec_qty)
    from ic_lines_fgs_temp i, ic_header_fgs_temp h, models m
    where h.tr_id=i.tr_id
    and i.item_id=m.pm_id(+)
    and h.iss_dept_id=90
    and h.rec_dept_id=53
    and h.inf5='P'
    and i.tyre_tube<>'TB'
    AND h.tr_date BETWEEN P_DATE1 AND P_DATE2
    group by h.inf6,h.inf4,h.po_num,h.ref2,m.m_desc,i.item_id);
    -- current receiving Transfer ------------
    INSERT INTO FGS_STK( cust_type, cust_id,
    sticker_id, vehicle_id, product, item_id, rec_indirect)
    (SELECT c.inf1,a.rec_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id, sum(i.qty)
    FROM transfer_header a, transfer_lines i, gl_companies c, sticker s,models m, vehicles v
    WHERE i.tr_id=a.tr_id
    AND a.tr_date BETWEEN P_DATE1 AND P_DATE2
    AND a.rec_dept_id=c.company_id(+)
    AND c.inf2=s.sticker_id(+)
    AND i.item_id=m.pm_id(+)
    AND m.m_desc_for_id=v.vehicle_id(+)
    AND m.m_desc<>'TB'
    GROUP BY c.inf1,a.rec_dept_id,c.inf2,m.m_desc_for_id,m.m_desc,i.item_id);
    COMMIT;
    END; -- Procedure
    table used in the procedure........
    CREATE TABLE fgs_stk
    (tr_id NUMBER(10,0),
    tr_date DATE,
    dept_id VARCHAR2(10) DEFAULT 90,
    cust_type VARCHAR2(300),
    cust_id VARCHAR2(10),
    sticker_id NUMBER(9,0),
    vehicle_id NUMBER(10,0),
    product VARCHAR2(2),
    item_id NUMBER(10,0),
    opng_bal NUMBER(10,2) DEFAULT 0,
    opng_rec NUMBER(10,2) DEFAULT 0,
    opng_iss NUMBER(10,2) DEFAULT 0,
    rec NUMBER(10,2) DEFAULT 0,
    iss NUMBER(10,2) DEFAULT 0,
    clsg_bal NUMBER(10,2) DEFAULT 0,
    clsg_req NUMBER(10,2) DEFAULT 0,
    target NUMBER(10,2) DEFAULT 0,
    trgt_rev1 NUMBER(10,2) DEFAULT 0,
    trgt_rev2 NUMBER(10,2) DEFAULT 0,
    trgt_rev3 NUMBER(10,2) DEFAULT 0,
    to_date_dc NUMBER(10,2) DEFAULT 0,
    to_date_rec NUMBER(10,2) DEFAULT 0,
    rec_indirect NUMBER(10,2) DEFAULT 0,
    iss_indirect NUMBER(10,2) DEFAULT 0,
    opng_rec_indirect NUMBER(10,2) DEFAULT 0,
    opng_iss_indirect NUMBER(10,2) DEFAULT 0,
    opng_iss_pack NUMBER(10,2) DEFAULT 0,
    iss_pack NUMBER(10,2) DEFAULT 0,
    opng_rec_pack NUMBER(10,2) DEFAULT 0,
    rec_pack NUMBER(10,2) DEFAULT 0,
    rec_ret NUMBER(10,2) DEFAULT 0,
    opng_rec_ret NUMBER(10,2) DEFAULT 0)
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    CREATE TABLE fgs_stock_opening
    (tr_id NUMBER NOT NULL,
    item_id NUMBER,
    qty NUMBER,
    tr_date DATE,
    ref1 DATE,
    ref2 NUMBER(20,0),
    ref3 NUMBER(20,0),
    books_id NUMBER(9,0) DEFAULT 1 NOT NULL,
    inf1 VARCHAR2(100),
    inf2 VARCHAR2(100) DEFAULT 'NO' NOT NULL,
    inf3 VARCHAR2(300),
    inf4 VARCHAR2(10),
    inf5 VARCHAR2(300),
    inf6 VARCHAR2(300),
    remarks VARCHAR2(2000),
    reversal VARCHAR2(1) DEFAULT 'N' NOT NULL,
    rec_type VARCHAR2(10) DEFAULT 'NA' NOT NULL,
    rec_type2 VARCHAR2(10) DEFAULT 'NA' NOT NULL,
    rec_status VARCHAR2(10) DEFAULT 'NORMAL' NOT NULL,
    rec_active VARCHAR2(1) DEFAULT 'Y' NOT NULL,
    rec_printed VARCHAR2(1) DEFAULT 'N' NOT NULL,
    rec_posted VARCHAR2(1) DEFAULT 'N' NOT NULL,
    system_rec VARCHAR2(1) DEFAULT 'N' NOT NULL,
    created_by VARCHAR2(30) DEFAULT USER,
    creation_date DATE DEFAULT SYSDATE NOT NULL,
    modified_by VARCHAR2(30) DEFAULT USER,
    modification_date DATE DEFAULT SYSDATE NOT NULL,
    times_modified NUMBER(9,0) DEFAULT 0 NOT NULL)
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    CREATE TABLE gl_companies
    (company_id VARCHAR2(10) NOT NULL,
    company_name VARCHAR2(50) NOT NULL,
    company_type VARCHAR2(1) DEFAULT 'C',
    contact_person VARCHAR2(50),
    phone1 VARCHAR2(50),
    phone2 VARCHAR2(50),
    fax VARCHAR2(50),
    gl_acct VARCHAR2(30) DEFAULT 'NA' NOT NULL,
    tax_id VARCHAR2(50),
    credit_limit NUMBER DEFAULT 0 NOT NULL,
    dr_bal NUMBER DEFAULT 0 NOT NULL,
    cr_bal NUMBER DEFAULT 0 NOT NULL,
    ref1 VARCHAR2(20),
    ref2 VARCHAR2(20),
    ref3 VARCHAR2(20),
    books_id NUMBER(9,0) DEFAULT 1 NOT NULL,
    inf1 VARCHAR2(300),
    inf2 NUMBER(9,0),
    inf3 VARCHAR2(300),
    inf4 VARCHAR2(300),
    inf5 VARCHAR2(300),
    inf6 VARCHAR2(300),
    remarks VARCHAR2(2000),
    rec_type VARCHAR2(10) DEFAULT 'NA' NOT NULL,
    rec_type2 VARCHAR2(10) DEFAULT 'NA' NOT NULL,
    rec_status VARCHAR2(10) DEFAULT 'NORMAL' NOT NULL,
    rec_active VARCHAR2(1) DEFAULT 'Y' NOT NULL,
    rec_printed VARCHAR2(1) DEFAULT 'N' NOT NULL,
    rec_posted VARCHAR2(1) DEFAULT 'N' NOT NULL,
    system_rec VARCHAR2(1) DEFAULT 'N' NOT NULL,
    created_by VARCHAR2(30) DEFAULT USER NOT NULL,
    creation_date DATE DEFAULT SYSDATE NOT NULL,
    modified_by VARCHAR2(30) DEFAULT USER NOT NULL,
    modification_date DATE DEFAULT SYSDATE NOT NULL,
    times_modified NUMBER(9,0) DEFAULT 0 NOT NULL,
    address VARCHAR2(300),
    country_id NUMBER(9,0),
    city_id NUMBER(9,0))
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    CREATE TABLE models
    (pm_id NUMBER NOT NULL,
    m_num VARCHAR2(80) NOT NULL,
    product_id VARCHAR2(2),
    m_status VARCHAR2(1),
    m_desc VARCHAR2(40),
    acc_code VARCHAR2(20),
    acc_code_stock VARCHAR2(20),
    acc_code_sales VARCHAR2(20),
    acc_code_cons VARCHAR2(20),
    part_no VARCHAR2(15),
    price NUMBER(12,2),
    branch_id VARCHAR2(3) DEFAULT 'NA' NOT NULL,
    unitms VARCHAR2(4),
    m_desc_for VARCHAR2(50),
    m_std_wt NUMBER(10,0),
    m_num_desc VARCHAR2(100),
    m_desc_for_id NUMBER(10,0),
    bundle NUMBER(10,0),
    pm_id_tyre NUMBER,
    pm_id_tube NUMBER,
    ref1 DATE,
    ref2 NUMBER(20,0) DEFAULT 0,
    ref3 NUMBER(10,5) DEFAULT 0,
    books_id NUMBER(9,0) DEFAULT 1 NOT NULL,
    inf1 VARCHAR2(100),
    inf2 VARCHAR2(100) DEFAULT 'NO' NOT NULL,
    inf3 VARCHAR2(300),
    inf4 VARCHAR2(300),
    inf5 VARCHAR2(300),
    inf6 NUMBER(10,0),
    remarks VARCHAR2(2000),
    reversal VARCHAR2(1) DEFAULT 'N' NOT NULL,
    rec_type VARCHAR2(10) DEFAULT 'NA' NOT NULL,
    rec_type2 VARCHAR2(10) DEFAULT 'NA' NOT NULL,
    rec_status VARCHAR2(10) DEFAULT 'NORMAL' NOT NULL,
    rec_active VARCHAR2(1) DEFAULT 'Y' NOT NULL,
    rec_printed VARCHAR2(1) DEFAULT 'N' NOT NULL,
    rec_posted VARCHAR2(1) DEFAULT 'N' NOT NULL,
    system_rec VARCHAR2(1) DEFAULT 'N' NOT NULL,
    created_by VARCHAR2(30) DEFAULT USER,
    creation_date DATE DEFAULT SYSDATE NOT NULL,
    modified_by VARCHAR2(30) DEFAULT USER,
    modification_date DATE DEFAULT SYSDATE NOT NULL,
    times_modified NUMBER(9,0) DEFAULT 0 NOT NULL,
    moulds NUMBER(20,0) DEFAULT 0,
    output NUMBER(20,0) DEFAULT 0,
    mix1_sc_a NUMBER(20,0) DEFAULT 0,
    mix1_sc_b NUMBER(20,0) DEFAULT 0,
    mix1_sc_c NUMBER(20,0) DEFAULT 0,
    mix2_sc_a NUMBER(20,0) DEFAULT 0,
    mix2_sc_b NUMBER(20,0) DEFAULT 0,
    mix2_sc_c NUMBER(20,0) DEFAULT 0,
    mix3_sc_a NUMBER(20,0) DEFAULT 0,
    mix3_sc_b NUMBER(20,0) DEFAULT 0,
    mix3_sc_c NUMBER(20,0) DEFAULT 0,
    wt_m1 NUMBER(20,0) DEFAULT 0,
    wt_m2 NUMBER(20,0) DEFAULT 0,
    wt_m3 NUMBER(20,0) DEFAULT 0,
    clsng_req NUMBER(20,0) DEFAULT 0,
    trgt_0 NUMBER(20,0) DEFAULT 0,
    trgt_1 NUMBER(20,0) DEFAULT 0,
    trgt_2 NUMBER(20,0) DEFAULT 0)
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    CREATE TABLE ic_header_fgs_temp
    (tr_id NUMBER(9,0),
    tr_date DATE,
    tr_type VARCHAR2(20),
    desp_no VARCHAR2(30),
    iss_dept_id NUMBER(3,0),
    iss_dept_desc VARCHAR2(50),
    iss_ref_type VARCHAR2(1),
    iss_comp_id VARCHAR2(10),
    iss_company_name VARCHAR2(50),
    rec_dept_id NUMBER(3,0),
    rec_dept_desc VARCHAR2(50),
    rec_ref_type VARCHAR2(1),
    rec_comp_id VARCHAR2(10),
    rec_company_name VARCHAR2(50),
    acc_num1 VARCHAR2(30),
    acc_num2 VARCHAR2(30),
    credit_period VARCHAR2(30),
    gl_assets VARCHAR2(30),
    gl_sale VARCHAR2(30),
    gl_cogs VARCHAR2(30),
    gl_cons VARCHAR2(30),
    app_id VARCHAR2(2),
    inv_num NUMBER(9,0),
    inv_date DATE,
    po_num NUMBER(9,0),
    ref1 DATE,
    ref2 NUMBER(20,0),
    ref3 NUMBER(20,0),
    books_id NUMBER(9,0),
    inf1 VARCHAR2(100),
    inf2 VARCHAR2(100),
    inf3 VARCHAR2(300),
    inf4 VARCHAR2(300),
    inf5 VARCHAR2(300),
    inf6 VARCHAR2(300),
    remarks VARCHAR2(2000),
    reversal VARCHAR2(1),
    rec_type VARCHAR2(10),
    rec_type2 VARCHAR2(10),
    rec_status VARCHAR2(10),
    rec_active VARCHAR2(1),
    rec_printed VARCHAR2(1),
    rec_posted VARCHAR2(1),
    system_rec VARCHAR2(1),
    created_by VARCHAR2(30),
    creation_date DATE,
    modified_by VARCHAR2(30),
    modification_date DATE,
    times_modified NUMBER(9,0),
    outlet_tr_id NUMBER(9,0),
    desp_in VARCHAR2(30),
    desp_out VARCHAR2(30),
    shift VARCHAR2(1),
    vehicle VARCHAR2(80),
    req_date DATE,
    req_no NUMBER)
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    CREATE TABLE ic_lines_fgs_temp
    (tr_id NUMBER(9,0),
    sr_no NUMBER(9,0),
    item_id NUMBER,
    item_desc VARCHAR2(50),
    hardware_id VARCHAR2(30),
    acc_num1 VARCHAR2(30),
    acc_num2 VARCHAR2(30),
    qty NUMBER,
    cost NUMBER,
    price NUMBER,
    rate NUMBER,
    wh_tax NUMBER,
    sales_tax NUMBER,
    discount NUMBER,
    gs_amount NUMBER,
    total_amount NUMBER,
    gl_assets VARCHAR2(30),
    gl_sale VARCHAR2(30),
    gl_cogs VARCHAR2(30),
    gl_cons VARCHAR2(30),
    app_id VARCHAR2(2),
    po_num NUMBER(9,0),
    ref1 NUMBER(10,0),
    ref2 VARCHAR2(20),
    ref3 VARCHAR2(20),
    books_id NUMBER(9,0),
    inf1 VARCHAR2(300),
    inf2 VARCHAR2(300),
    inf3 NUMBER(15,0),
    inf4 NUMBER(15,0),
    inf5 NUMBER(15,0),
    inf6 NUMBER(15,0),
    remarks VARCHAR2(2000),
    reversal VARCHAR2(1),
    rec_type VARCHAR2(10),
    rec_type2 VARCHAR2(10),
    rec_status VARCHAR2(10),
    rec_active VARCHAR2(1),
    rec_printed VARCHAR2(1),
    rec_posted VARCHAR2(1),
    system_rec VARCHAR2(1),
    created_by VARCHAR2(30),
    creation_date DATE,
    modified_by VARCHAR2(30),
    modification_date DATE,
    times_modified NUMBER(9,0),
    iss_dept_id VARCHAR2(10),
    line_id NUMBER(9,0),
    rec_qty NUMBER(*,0),
    acc_qty NUMBER(*,0),
    rej_qty NUMBER(*,0))
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    CREATE TABLE dcm_temp
    (dc_id NUMBER(15,0) NOT NULL,
    buyer_id VARCHAR2(10),
    u_id NUMBER(5,0) NOT NULL,
    si_id NUMBER(15,0),
    dc_num VARCHAR2(15),
    dc_date DATE NOT NULL,
    remarks VARCHAR2(300),
    ref1 VARCHAR2(20),
    ref2 VARCHAR2(20),
    ref3 VARCHAR2(20),
    books_id NUMBER(9,0) NOT NULL,
    inf1 VARCHAR2(300),
    inf2 VARCHAR2(300),
    inf3 VARCHAR2(300),
    inf4 VARCHAR2(300),
    inf5 VARCHAR2(300),
    inf6 VARCHAR2(300),
    rec_type VARCHAR2(10) NOT NULL,
    rec_type2 VARCHAR2(10) NOT NULL,
    rec_status VARCHAR2(10) NOT NULL,
    rec_active VARCHAR2(1) NOT NULL,
    rec_printed VARCHAR2(1) NOT NULL,
    rec_posted VARCHAR2(1) NOT NULL,
    system_rec VARCHAR2(1) NOT NULL,
    created_by VARCHAR2(30) NOT NULL,
    creation_date DATE NOT NULL,
    modified_by VARCHAR2(30) NOT NULL,
    modification_date DATE NOT NULL,
    times_modified NUMBER(9,0) NOT NULL,
    so_id NUMBER(15,0))
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    CREATE TABLE dcd_temp
    (dcd_id NUMBER(15,0) NOT NULL,
    dc_id NUMBER(15,0) NOT NULL,
    ref_num NUMBER(7,0),
    prd_qty NUMBER(7,0) NOT NULL,
    otype VARCHAR2(1),
    oem_prd VARCHAR2(1),
    ref1 NUMBER(10,2),
    ref2 VARCHAR2(20),
    ref3 VARCHAR2(20),
    books_id NUMBER(9,0) NOT NULL,
    inf1 VARCHAR2(300),
    inf2 VARCHAR2(300),
    inf3 VARCHAR2(300),
    inf4 VARCHAR2(300),
    inf5 VARCHAR2(300),
    inf6 VARCHAR2(300),
    remarks VARCHAR2(2000),
    rec_type VARCHAR2(10) NOT NULL,
    rec_type2 VARCHAR2(10) NOT NULL,
    rec_status VARCHAR2(10) NOT NULL,
    rec_active VARCHAR2(1) NOT NULL,
    rec_printed VARCHAR2(1) NOT NULL,
    rec_posted VARCHAR2(1) NOT NULL,
    system_rec VARCHAR2(1) NOT NULL,
    created_by VARCHAR2(30) NOT NULL,
    creation_date DATE NOT NULL,
    modified_by VARCHAR2(30) NOT NULL,
    modification_date DATE NOT NULL,
    times_modified NUMBER(9,0) NOT NULL,
    color VARCHAR2(50),
    prd_rate NUMBER(10,2) NOT NULL,
    deliver_qty NUMBER(10,0))
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    TABLESPACE system
    STORAGE (
    INITIAL 65536
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    /

  • FRM-40735:KEY-COMMIT  ORA-02291 trigger raised unhandled exception

    FRM-40735:KEY-COMMIT ORA-02291 trigger raised unhandled exception. when i tried to save records.
    I am using multi record block , 12 records will display at a time, i am trying to save 1st and 5th record which i changed.
    calling a procedure in key-commit trigger
    PROCEDURE desig_updation IS
    V_count number := get_block_property('employee_master',query_hits);
    BEGIN
    go_block('employee_master');
    first_record;
    for i in 1.. V_count loop
         if((:desig is not null ) and (:new_date is not null) and (:emp_desig<>:desig) and (:new_date >=:emp_desig_date)) then
              :emp_desig :=:desig;
              :emp_grade:=:grade;
              :emp_desig_date:=:new_date;
              :emp_upd_by:=:global.usr;
              :emp_upd_on:=:system.current_datetime;
              if( (:radio_group=2) and (:incr_amt is not null)) then
                   increment_process;
                   end if;
         end if;
         if :system.last_record ='TRUE' then exit;
         else next_record;
         end if;     
    end loop;
    END;
    PROCEDURE commit_action IS
    BEGIN
    desig_updation;
    commit_form;
    IF FORM_SUCCESS THEN
    CLEAR_FORM(NO_VALIDATE);
    EXECUTE_TRIGGER('PRE-FORM');
    END IF;     
    END;
    key-commit-trigger
    commit_action;
    commit_form;
    IF FORM_SUCCESS THEN
    CLEAR_FORM(NO_VALIDATE);
    EXECUTE_TRIGGER('PRE-FORM');
    END IF;
    PROCEDURE increment_process IS
    m_gross_sal number;
    p_rslt varchar2(200);
    p_status varchar2(20);
    BEGIN
    delete from INCR_TEMP where ECODE = :emp_code ;
    m_gross_sal := aod_gross_salary(:emp_orgn,:emp_code,'A');--find current salary
    insert into INCR_TEMP(ECODE , CURR_SAL ,
    INCREMENT_AMT ,TOTAL_AOD,
    STATUS,INCR_TYPE)
    values(:emp_code,m_gross_sal,
    :incr_amt,m_gross_sal+:incr_amt,
    'N','I');
    forms_ddl('commit');
    update_emp_increment(:emp_orgn,:emp_code,
    TRUNC(to_date(to_char(:new_Date,'DD/MM/YYYY'),'DD/MM/YYYY')),null,
    :incr_amt, p_rslt,
    :parameter.p_user,to_date(to_char(SYSDATE,'DD/MM/YYYY'),'DD/MM/YYYY'),'I',
    p_status);
    END;
    thanks,
    rinz

    It seems you are insert some data in child table. For which parent data does not exist. In simple primary key values does not exist while you are trying to insert in foreign key values. check this link.
    http://www.lmgtfy.com/?q=ORA-02291
    -Ammad

  • Error message in procedure

    Hi i am creating a procedure called p_update_member with the following code.
    PROCEDURE p_update_member IS
    BEGIN
         update member
         set memberno = :member.memberno,
         where memberno = :member.memberno;
    END;
    When i compile the above code i get the error message
    ERROR 103 AT LINE 6, COLUMN 2
    ENCOUNTERED THE SYMBOL 'WHERE' WHEN EXPECTING THE F0LLOWING;
    (<AN IDENTIFIER><A DOUBLE-QUOTED DELIMITED-IDENTIFIER>
    and the error
    ERROR 103 AT LINE 8, COLUMN 1
    ENCOUNTERED THE SYMBOL "END".
    Can somone tell me why i get this error message.?
    Message was edited by:
    nvidia1

    Looks like you have an unnecessary comma.
    PROCEDURE p_update_member IS
    BEGIN
    update member set memberno = :member.memberno,
    where memberno = :member.memberno;
    END;

  • A query in Stored Procedure

    Hi ,
    I am using EXECUTE IMMEDIATE to execute a DDL Statement inside a Stored Procedure .
    But i am unable to see this table , please tell me why .
    create or replace procedure NAmes
    is
    begin
    EXECUTE IMMEDIATE 'CREATE TABLE execute_table (col1 VARCHAR(10))';
    commit;
    end;
    Procedure created.

    Hi,
    user10503747 wrote:
    I am using EXECUTE IMMEDIATE to execute a DDL Statement inside a Stored Procedure .Why? Performing DDL in strored procedures is usually not the best way to do things in Oracle.
    Whenever you have a problem, post a compete test script that people can use to re-create the problem and test their ideas. The CREATE TABLE statement that you posted was a good start; add code to show how you ran it, and what you did to see if it worked or not.
    For example:
    create or replace procedure NAmes
    is
    begin
        EXECUTE IMMEDIATE 'CREATE TABLE execute_table (col1 VARCHAR(10))';
        commit;   -- Not needed.  DDL automatically causes COMMIT
    end;
    SHOW ERRORS
    PROMPT     =====  Before Running Names Procedure  =====
    DESCRIBE     execute_table
    EXEC  names;
    PROMPT     =====  After Running Names Procedure  =====
    DESCRIBE     execute_tableThis worked fine for me in Oracle 10.2.0.1.0 and SQL*Plus 10.2. Output:
    Procedure created.
    No errors.
    =====  Before Running Names Procedure  =====
    ERROR:
    ORA-04043: object execute_table does not exist
    PL/SQL procedure successfully completed.
    =====  After Running Names Procedure  =====
    Name                                      Null?    Type
    COL1                                               VARCHAR2(10)What are you doing different?
    Did you get any error messages?
    Are you creating the procedure in one schema, and running it in another?
    Did you call the names procedure from another procedure?
    Don't make people guess. Guessing is not the best way to solve problems.

Maybe you are looking for