Select with Apostrophe

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Tue, 11 Apr 2006 10:18 am

The problem lies in the Apostrophe SELECT * from dual where Aparecida d'oeste ' = ' Aparecida d'oeste ';

I tried to replace the missing right parenthesis error can anyone help me????


Thanks
Graciela Silva Barbosa
Location: SP

Poston Tue, 11 Apr 2006 10:24 am

Putting 2 apostrophes!

Code: Select all
SELECT *
from dual
where 'Aparecida d'' Oeste' = 'Aparecida d'' Oeste';
Or the CHR (39)
Code: Select all
SELECT *
from dual
where 'Aparecida d'|| chr(39)||' Oeste' = 'Aparecida d'' Oeste';
:-
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Tue, 11 Apr 2006 10:46 am

Thanks for answer, congratulations on your effectiveness and efficiency.


But in the case of my comparisons be return of the Bank as I could access them so that he could perform this exchange for putting 2 apostrophes Thanks
Graciela Silva Barbosa
Location: SP

Poston Tue, 11 Apr 2006 11:28 am

Inside the Bank, the apostrophe is normal.

Here's an example:
Code: Select all
SQL> create table t (campo varchar2(100));

Table created.

SQL> insert into t values ('That''s the way');

1 row created.

SQL> select * from t;

CAMPO
---------------------------------------------------
That's the way

SQL> select * from t
  2  where campo like 'That''s%way';

CAMPO
---------------------------------------------------
That's the way

SQL>
Why use CHR (39) sometimes \"less complicated\" because you simply concatenates the character where you want.

Code: Select all
SQL> select *
  2  from t
  3  where campo like 'That'|| chr(39) || '%way';

CAMPO
-------------------------------------------------
That's the way

SQL>
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered



Return to SQL

Who is online

Users browsing this forum: Google [Bot] and 2 guests