Re: No resultset with ocibindbyname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> And here is the output of "desc projekte_generisch":
> Name 	Null? 	Type
> PID 		NOT NULL 	CHAR(8)
> ANFANG 	NOT NULL 	VARCHAR2(8)
> ENDE 	  			VARCHAR2(8)
> LAENGE 	NOT NULL 	NUMBER

I believe the problem has to do with your field type for PID. When you run:

  select * FROM  projekte_generisch where pid='u0test'

Oracle either autotrims or autopads (I'm not sure which) so that
'u0test' matches PID even though PID has a fixed 8-character length. But
when you use bind variables, this doesn't happen. So you'll need to use:

  select * FROM  projekte_generisch where trim(pid)=:pid

Or you can change the field definition on PID to varchar2.

I tested this on one of our tables which has a char(4) primary key to
verify all this:

  select count(*) from subject_area where subject_area = 'EE';

returns 1. But using a bind variable:

  declare
    v_sa  varchar2(10);
    v_count number;
  begin
    v_sa := 'EE';
    select count(*) into v_count
      from subject_area where subject_area = v_sa;
    dbms_output.put_line(v_count);
  end;

returns a 0.

-Roberto

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux