Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Question Unanswered: begin and commit

    Hi,

    I executed query in Oracle8i in the following way.

    begin; delete from <table_name> where col1 = <value>; commit; end

    It executed fine.

    If i want to execute a similar kind of query in DB2 means how to proceed?

    I already tried various ways like begin atomic, compound. I referred DB2 manuals also.

    As a new user to DB2, i couldn't able to find a solution.
    Any suggestions/comments are welcome.

    Thanks in advance.

    Regards,
    Muthu

  2. #2
    Join Date
    Mar 2004
    Posts
    4

    Re: begin and commit

    I had the same problem just a little while ago. I know that this does work cause I have tried it.

    "A Transaction is implicitly begun whenever any data is read or written [ie with an executed SQL statement] and is ended by a COMMIT or ROLLBACK"
    That is taken from A Complete Guide To DB2.

    I have looked in the db2 manuals and they reiterate this same point.

    It is annoying I know, but that's the way it works.

    rleibold

  3. #3
    Join Date
    Jan 2004
    Location
    Egypt
    Posts
    61

    Re: begin and commit

    Originally posted by muthu2004
    Hi,

    I executed query in Oracle8i in the following way.

    begin; delete from <table_name> where col1 = <value>; commit; end

    It executed fine.

    If i want to execute a similar kind of query in DB2 means how to proceed?

    I already tried various ways like begin atomic, compound. I referred DB2 manuals also.

    As a new user to DB2, i couldn't able to find a solution.
    Any suggestions/comments are welcome.

    Thanks in advance.

    Regards,
    Muthu

    try this:

    > vi file1 ( this is unix/linux editor )

    put follwoing commnads in file then tun it from command line

    connect to db_name user xxx using yyyy ;

    delete from table xxxx where col1 = yyyy ;

    commit ;

    :wq


    from the command line type
    > db2 -stf file1

    by the way using embeded SQL with C code u can define save point (start/end) of any transaction , u can also commit or rollback to certian saved point

    hany heggy,
    IBM certified Professional, AIX system support
    www.melodyhits.tv

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •