- create or replace procedure test_nvarchar2 is
- v_temp varchar2(999);
- begin
- select t.father into v_temp from test1 t where t.father = 'wahah';
- insert into test2 values (v_temp);
- exception
- when no_data_found then
- dbms_output.put_line(v_temp);
- end;
- create or replace procedure test_nvarchar2 is
- v_temp nvarchar2(999);
- begin
- select t.father into v_temp from test1 t where t.father = 'wahah';
- insert into test2 values (v_temp);
- exception
- when no_data_found then
- dbms_output.put_line(v_temp);
- end;
上下两段代码中,只有v_temp的类型不一样,一个是varchar2,另一个是nvarchar2,在使用nvarchar2时,在用pl/sql developer debug时,v_temp显示始终为null,尽管实际是有值的。而varchar2在debug时可以见值,不知道为什么,虽然结果都是能正确插入值到test2表中
转载于:https://blog.51cto.com/wanqiufeng/698377