1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

transaction- can't make an error!

Discussion in 'General' started by monkey, Apr 24, 2014.

  1. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    Hello!
    Sending another code for transaction!

    the transaction works, adds 4th row to the 3 -rown containing table.

    Code (Text):
    begin
    savepoint sp1;

    insert into m values(4,'dd', 'DDD');



    COMMIT;

    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK TO SP1;

    raise_application_error(-20100, SQLERRM);
    END;
    I was told, the error woudl rise, if I tried to insert WRONG TYPE,
    so I tried like:

    Code (Text):
    begin
    savepoint sp1;

    insert into m values('4','dd', 'DDD');



    COMMIT;

    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK TO SP1;

    Masking 4(integer) to varchar2, hopping this to cause RISE THE ERROR SQLERRM.

    But, the damn thing did nto want to notice i wrote '4' instead of 4, and i just got 4th row, the same as in first example.

    Please, what to do to see SQLERRM???
    many thanks!!!

    raise_application_error(-20100, SQLERRM);
    END;
     
  2. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
    Hi.
    For a start : study basic functional capabilities, study transactional models and put correct experiments.
    We, all those who helped you, links to you already gave enough to start study.
     
    monkey likes this.
  3. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    use this...

    dbms_output.put_line(SQLERRM);
     
    monkey likes this.
  4. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    Hello, All!
    Solved!!!
    p.s. Probolem was, I was doing al on just one table, thinking it woul be easier, btu it is NOT, EASIER IS ON 2 TABLES...LATER ABOUT IT, HURRING TO TRIGERS NOW!!!
    MANY THANKS PEOPLE!!!!