解决方案 »
- oracle客户端字符集
- 求一条sql语句。创建的表都有了。现在根据要求来得到输出。
- windows2003.64位配nginx0.8.54+php+mysql出现oci_connect(): OCIEnvNlsCreate() failed.
- 怎样使视图上某个计算列的函数索引起作用?
- 组合外健的定义.急求帮助
- 请问ORACLE中,system,sys,root,sysdba,这4种用户的默认密码是什么,如果忘记了如何找到他们,我现在就忘记了,可我都不知道怎么找到。谢
- Oracle81密码
- 帮忙把一段sqlserver的函数转成oracle.
- 监听器问题(急)
- 请问如何从oracle数据库中导出某个用户创建的全部存储过程?
- sql复制数据
- oracle 不是group by表达式;
declare
v_name varchar2(50);
begin
for i in 100..300 loop
begin
select first_name || '.' || last_name into v_name from employees where employee_id = i;
dbms_output.put_line('#' || i || ': ' || v_name);
exception
when no_data_found then
dbms_output.put_line('Not find #' || i);
when others then
exit;
end;
end loop;
end;
2 as
3 v_num number(10);
4 begin
5 for i in 1..10 Loop
6 begin
7 select a into v_num from t_test where a=i; -- 查不到就抛no_data_found
8 dbms_output.put_line('we get it');
9 exception when no_data_found then -- 遇到异常做一些处理
10 dbms_output.put_line('something wrong');
11 end;
12
13 end Loop;
14 end;
15 /
Procedure created
SQL> exec proc_test_continue
we get it
something wrong
something wrong
something wrong
something wrong
something wrong
something wrong
something wrong
something wrong
something wrong
PL/SQL procedure successfully completed
SQL>
declare
begin
exception
enddeclare里面的变量仅在本块及其子块有意义.类似c里面函数的局部变量.
2 as
3 v_num number(10);
4 begin
5 for i in 1..10 Loop
6 declare
7 v_c varchar2(10);
8 begin
9 v_c:='123';
10 select a into v_num from t_test where a=i; -- 查不到就抛no_data_found
11 dbms_output.put_line('we get it');
12 exception when no_data_found then -- 遇到异常做一些处理
13 dbms_output.put_line('something wrong');
14 exit;
15 end;
16 end Loop;
17 dbms_output.put_line('exit successful');
18 end;
19 /
Procedure created
SQL> exec proc_test_continue
we get it
something wrong
exit successful
PL/SQL procedure successfully completed
SQL>