数据库

 首页 > 数据库 > Oracle > PLSQL select into为空的时候报错的处理方法

PLSQL select into为空的时候报错的处理方法

分享到:
【字体:
导读:
         摘要:PLSQLselectinto为空的时候报错的处理方法在存储过程中selectcolumnintot_prop。。。当查询不到值的时候会报错,这时候的处理方法为:使用聚合函数,比如:[sql]createorreplaceprocedurete... SyntaxHighlight...

PLSQL select into为空的时候报错的处理方法

PLSQL select into为空的时候报错的处理方法
 
在存储过程中select column into t_prop 。。。
 
当查询不到值的时候会报错,这时候的处理方法为:
 
使用聚合函数,比如:
 
[sql]
create or replace procedure test is  
t_prop varchar2(20);  
begin  www.2cto.com    
         select max(sales_no) into t_prop from sales_card where 1=2;  
end test;  
 
即可。
 
当然也要根据业务确定是否需要这样的数据
 
 
 
摘自 yangaming的专栏
PLSQL select into为空的时候报错的处理方法
分享到:
Oracle SQLServer MySQL查看当前所有数据...
Oracle SQLServer MySQL查看当前所有数据库表名及其他信息 Oracle SQLServer MySQL查看当前所有数据库表名及其他信息   环境:Oracle 11g + SQLServer 2008 R2 + MySQL 5.1   Oracle: 1. 查看当前库的所有数据表   [sql] select * from all_tables;   select table_name from all_tables;   select table_name from...
oracle数据文件"*.dbf"的转移
oracle数据文件"*.dbf"的转移 转移oracle数据文件"*.dbf"   转移过程: 1.先登录sqlplus:  C:/Documents and Settings/jbdu>sqlplus “/as sysdba” 2.修改表空间为Offline:  www.2cto.com    SQL> alter tablespace users offline;  3.拷贝表空间文件  拷贝  D:/oracle/product/10.2.0/oradata/orclado/USER...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……