Home » Developer & Programmer » Forms » Bad Bind Variable
Bad Bind Variable [message #134153] Tue, 23 August 2005 13:04 Go to next message
Jon`
Messages: 1
Registered: August 2005
Junior Member
Let me start off by saying I know next to nothing about Oracle. Boss is packed with other work so he assigned this to me, so I figured I'd try to find help on the forums here.

Here's the code:
PROCEDURE display_from_photo(vNameID IN Number) 
IS
   vFilename Varchar2(1000);
   vYear Varchar2(4);
   vLocCode Varchar2(1);
   vLBN Varchar2(25);
   vBookDateTime Date;

  --Sean: use this to obtain the atn last arrest 9/17/2002
  cursor atn_cur IS 
    select atn, book_date_time 
    from jp_arrest 
    where nameid = vNameid 
    order by atn desc;
  atn_rec atn_cur%rowtype;

  cursor name_cur is 
    select last,first,dob,race,sex 
    from jp_names 
    where nameid = vNameid;
  name_rec name_cur%rowtype;    

  vATN Number(12);

  cursor arrest_cur is
    select book_date_time
    from jp_arrest
    where jp_arrest.atn = vATN;
  arrest_rec arrest_cur%rowtype;

  loop_count 	number := 1;
  vLastArrest BOOLEAN := FALSE;
  vAgeNow 		number(3,1);

begin

--	raise_note_alert('vNameid - '||vNameid);

	 if :global.photos_avail = 'Y' then
      :global.calling_block := :system.cursor_block;

      open atn_cur;--Sean: use this to obtain the atn last arrest 9/17/2002
      loop
--raise_note_alert('global.loopsy - '||:global.loopsy);
      	exit when loop_count = :Global.loopsy;
      fetch atn_cur into atn_rec;
      if not atn_cur%found then
      	 vLastArrest := TRUE;
          raise_stop_alert('Unable to locate an arrest record, so there is no photo taken.');
          raise form_trigger_failure;
      end if;
      loop_count := loop_count + 1;
       end loop;
       close atn_cur;
      
       :system.message_level := '25';

       vATN := atn_rec.atn;
            if :global.photo_directory is null then    	
            	  raise_stop_alert('The photo directory has not been entered on your setup ' ||
            	                   'record, unable to display photo.');
            	  raise form_trigger_failure;
            else
            	
            	if substr(:global.photo_directory,length(:global.photo_directory),1) != '\' THEN
            		break;
            		 :global.photo_directory := :global.photo_directory ||'\';
            	END IF;
            	--:global.photo_directory := rpad(:global.photo_directory,'\',1);
                 vFileName := :global.photo_directory || SUBSTR(vATN,5,8)|| '.JPG';
            end if;          	
    --    end if; -- If non JPSO agency
		--    raise_stop_alert(vFileName);        
    read_image_file(vFilename, 'JFIF', 'FROM_PHOTO');
    photo.disp_book_date_time := atn_rec.book_date_time;
    open name_cur;
    fetch name_cur into name_rec;
    photo.disp_last := name_rec.last;
    photo.disp_first := name_rec.first;
    photo.disp_dob := name_rec.dob;
    photo.disp_race := name_rec.race;
    photo.disp_sex := name_rec.sex;
    photo.disp_age_now := trunc((months_between (sysdate,name_rec.dob)/12),0);
    photo.disp_age_at_booking := trunc((months_between (atn_rec.book_date_time,name_rec.dob)/12),0);
    photo.disp_atn := atn_rec.atn;
    
    close name_cur;
   IF NOT FORM_SUCCESS THEN
   	   IF vLastArrest THEN
          raise_stop_alert('There is no photo on file for this person.');
      ELSE
         :Global.loopsy := :Global.loopsy + 1;
         display_from_photo(vNameid);
       END IF;
   else
       go_block('photo_from_photo');
   END IF;
   :SYSTEM.MESSAGE_LEVEL := '0';

   else
   	   raise_stop_alert('Photo records are not defined on your agency setup file.  To use the ' ||
   	                    'photo option, you must enter the required fields on your setup record.');
   end if;
end;


It blows up on all the lines with
photo.disp_book_date_time := atn_rec.book_date_time;
and gives me the error "Bad Bind Variable."

Like I said, I know pretty much next to nothing about Oracle, so putting the solution in simple terms would be helpful.
Thanks for any help
Re: Bad Bind Variable [message #134158 is a reply to message #134153] Tue, 23 August 2005 13:30 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Jon, I would suggest posting this in the Developer & Programmer/Forms forum, since this error is specific to Forms or D2K, not PL/SQL.
Re: Bad Bind Variable [message #134265 is a reply to message #134153] Wed, 24 August 2005 02:25 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Verify that the data type for photo.disp_book_date_time and atn_rec.book_date_time are the same.

David
Previous Topic: CREATE_RECORD question
Next Topic: Scroll mouse in forms6
Goto Forum:
  


Current Time: Fri Sep 20 01:37:18 CDT 2024