Oracle
 sql >> Cơ Sở Dữ Liệu >  >> RDS >> Oracle

Làm thế nào để xử lý ngoại lệ và thực thi các câu lệnh còn lại?

bọc các dòng bằng begin ... end ... exception nó giống như thử / bắt

for i in 1..acd.count loop

begin 
   insert into customer_account_mapping select customerid,upper(pcd(i)),upper(acd(i)),cost from customer_master where customername=customer_name and concat(upper(pcd(i)),upper(acd(i))) not in (select concat(upper(pcode),upper(acode)) from customer_account_mapping);
exception when others then 
   -- handle the exception
end;

insert into user_permissions select distinct user_id,sales_person_name,sales_mgr_name,upper(pcd(i)),upper(acd(i)) from user_permissions where sales_person_name=sales_person and concat(upper(pcd(i)),upper(acd(i))) not in (select concat(upper(pcode),upper(acode)) from user_permissions) and rownum<2 ;
commit;
end loop;


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Cách điền trường dấu thời gian với dấu thời gian hiện tại bằng Oracle Sql Loader

  2. Bitwise độc ​​quyền HOẶC trong Oracle

  3. Làm thế nào để chọn một nhà cung cấp Oracle cho ứng dụng .Net?

  4. Chế độ xem cụ thể hóa với trình kích hoạt?

  5. PL / SQL để tìm kiếm một chuỗi trong toàn bộ cơ sở dữ liệu