PL/SQL block problem: No data found error

When you are selecting INTO a variable and there are no records returned you should get a NO DATA FOUND error. I believe the correct way to write the above code would be to wrap the SELECT statement with it’s own BEGIN/EXCEPTION/END block. Example: … v_final_grade NUMBER; v_letter_grade CHAR(1); BEGIN BEGIN SELECT final_grade INTO v_final_grade … Read more

BEGIN – END block atomic transactions in PL/SQL

Firstly, BEGIN..END are merely syntactic elements, and have nothing to do with transactions. Secondly, in Oracle all individual DML statements are atomic (i.e. they either succeed in full, or rollback any intermediate changes on the first failure) (unless you use the EXCEPTIONS INTO option, which I won’t go into here). If you wish a group … Read more