---
title: "oracle中关于no_data_found异常的解决"
author: "xiajava2011"
date: "2011-09-05T18:01:04Z"
tags: []
categories: ["数据库"]
slug: "oracle-no-data-found"
draft: false
lastmod: "2011-09-05T18:01:55Z"
id: 1166029
url: "https://xiajava2011.iteye.com/blog/1166029"
---

```
在存储过程中，select name into v_name from table where 条件  的时候,如果没有查询到数据，
就不能将v_name进行赋值，就会抛出no_data_found异常，程序不能继续执行


解决：select count(*) into v_count from from table where 条件 ；
        if(v_count<>0) then
           select name into v_name from table where 条件;
        end if;
```