Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Same query, different results
Thorsten Jens schrieb:
> On Apr 19, 11:27 am, Robert Klemme <shortcut..._at_googlemail.com> wrote:
> > No, all columns start with the zvz_tnswhdw_ prefix. > > Thorsten > >
Is your column by any chance of datatype CHAR ? Then it could be the possible reason:
SQL> CREATE TABLE a AS SELECT CAST('hello' AS CHAR(10)) text FROM dual;
Table created.
SQL> SET ECHO ON SQL> SET SERVEROUTPUT ON SQL> declare
2 res varchar2(100);
3 x varchar2(100);
4 begin
5 x:='hello';
6 BEGIN
7 select 'selected with literal successful' into res from a where
text='hello';
8 dbms_output.put_line(res);
9 EXCEPTION
10 WHEN OTHERS THEN
11 dbms_output.put_line('selected with literal failed');
12 res:=SQLERRM;
13 dbms_output.put_line(res);
14 END;
15
16 BEGIN
17 select 'selected with padded variable successful' into res from a
where text=rpad(x,10,' ');
18 dbms_output.put_line(res);
19 EXCEPTION
20 WHEN OTHERS THEN
21 dbms_output.put_line('selected with padded variable failed');
22 res:=SQLERRM;
23 dbms_output.put_line(res);
24 END;
25
26 BEGIN
27 select 'selected with variable successful' into res from a where
text=x;
28 dbms_output.put_line(res);
29 EXCEPTION
30 WHEN OTHERS THEN
31 dbms_output.put_line('selected with variable failed');
32 res:=SQLERRM;
33 dbms_output.put_line(res);
34 END;
35 end;
36 /
selected with literal successful
selected with padded variable successful
selected with variable failed
ORA-01403: no data found
PL/SQL procedure successfully completed.
Best regards
Maxim Received on Thu Apr 19 2007 - 12:56:14 CDT
![]() |
![]() |