- 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表中