Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exception when no_data_found then variable =: 'Text field of my choice'

888181Jan 31 2012 — edited Feb 1 2012
Hi,

I have an exception in a package I have created. The package compiles fine but when I test it nothing is returned. I want TEXT 'NULL' to be returned as I'll use this in a lookup later on.
EXCEPTION WHEN no_data_found THEN
  v_Passangers                  :='NULL';
  v_Third_Party                 :='NULL';
  v_Witnesses                   :='NULL';  
  v_Authorities                 :='NULL';
begin
  MyPackage.Load_Context_1(355271);

  dbms_output.put_line('v_Passangers : '||MyPackage.v_Passangers );
  dbms_output.put_line('v_Third_Party : '||MyPackage.v_Third_Party );
  dbms_output.put_line('v_Witnesses   : '||MyPackage.v_Witnesses  );
  dbms_output.put_line('v_Authorities   : '||MyPackage.v_Authorities );
end;
RETURNS:
v_Passangers:
v_Third_Party:
v_Witnesses:
v_Authorities:                       
I Would Like:
v_Passangers: NULL
v_Third_Party: NULL
v_Witnesses: NULL
v_Authorities: NULL
Thanks!!!

Variables are defined as varchar2(100) in the package and are 'Selected into' in the package body in the procedure PROCEDURE Load_Context_1(ID in number);

NO_DATA_FOUND is occurring because ID 355271 that I pass sits in the database on a table and the data that I select into the V_Variables is not present.

I realize that 'NULL' is not the best text word to use but for the purposes of this question please humour me.


Banner:
Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
This post has been answered by Nikolay Savvinov on Jan 31 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 29 2012
Added on Jan 31 2012
6 comments
520 views