Special Characters in SELECT Query
What is the right way of using Special character '*' in SELECT Query.
Say..
SELECT PSPID FROM PROJ
INTO TABLE IT_P_PROJ
WHERE PSPID EQ P_PROJ
In this P_PROJ is SS*. No value is populating for this . Pls suggest where am I going wrong?
hi
chk this out
Field descriptor
Variants:
1. f
2. dbtab~field
3. tabalias~field
Effect
Used in the SELECT, OPEN CURSOR, UPDATE and DELETE commands to uniquely identify columns (fields) of database tables and views specified in FROM clauses.
Variant 1
f
Effect
Identifies the field f of a database table or view specified in the FROM clause. The name f may only occur once in all database tables or views, that is, it must be unique. You use this variant particularly when there is only one table specified in the FROM clause. If the uniqueness of the field cannot be guaranteed, you must use variant 2 or 3.
Example
Output a list of all customers whose names begin with 'A':
DATA: WA_SCUSTOM TYPE SCUSTOM.
<b>SELECT * FROM SCUSTOM INTO WA_SCUSTOM WHERE NAME LIKE 'A%'.
WRITE: / WA_SCUSTOM-ID, WA_SCUSTOM-NAME.
ENDSELECT</b>.
Variant 2
dbtab~field
Effect
Identifies field f in the database table or view dbtab specified in the FROM clause. The combination dbtab~field must be unique. You can use this variant if table dbtab only appears once in the FROM clause. If this uniqueness cannot be assured, you must use variant 3.
Example
Output a list of all customers whose names begin with 'A':
DATA: WA_SCUSTOM TYPE SCUSTOM.
<b>SELECT * FROM SCUSTOM INTO WA_SCUSTOM
WHERE SCUSTOM~NAME LIKE 'A%'.
WRITE: / WA_SCUSTOM-ID, WA_SCUSTOM-NAME.
ENDSELECT.</b>
Variant 3,,tabalias~field
Effect
Identifies field f in the table or view with the alias name tabalias specified in the FROM clause.
Example
Output a list of all customers whose name begins with 'A':
DATA: WA_SCUSTOM TYPE SCUSTOM.
SELECT * FROM SCUSTOM AS T INTO WA_SCUSTOM WHERE T~NAME LIKE 'A%'.
WRITE: / WA_SCUSTOM-ID, WA_SCUSTOM-NAME.
ENDSELECT.
Additional help
Similar Messages
-
How to check multiple special characters in this query.
When the master_title has no comma in it, I am getting an empty master_title. This is because INSTR(master_title,',',1,1) is returning 0.
In addition, I want to be able to specify other characters besides the comma. Example: ":" "/" "-".
Can we fit these options in the INSTR to look for them as well?
Query given below.
SELECT DISTINCT e.brm_id, SUBSTR(master_title,1,INSTR(master_title,',',1,1)-1) master_title
FROM e_m_view e
WHERE e.asset_dist LIKE'%WBPI Germany%'
OR e.asset_dist LIKE '%krupp%'
OR e.asset_dist IN (SELECT FN_SETRPTG(FN_GETPIREGN('%WBPI%')) FROM dual)
AND e.kl='Live' AND NVL(wbpi_publish_date,SYSDATE) <= SYSDATE
ORDER BY 2 ASC;
---------------------This?
SQL> with t as(
2 select 'abcd,efgh' name from dual union all
3 select 'abcd:efgh' from dual union all
4 select 'abcd/efgh' from dual union all
5 select 'abcd-efgh' from dual )
6 select regexp_substr(name,'[^,:/-]+') name
7 from t;
NAME
abcd
abcd
abcd
abcd -
Prevent interpretation of special characters in enter-query mode
My problem goes as follows:
- forms version: Forms [32 Bit] Version 6.0.8.10.3 (Production)
- non-database item block.X, char
- block.X is filled in post-query trigger. The post-query logic cannot be integrated in a view because it uses procedures, and usage of a pipelined function + view is currently not allowed due to "internal restrictions". Put simply: all logic to fill the field must remain in the post-query trigger
- user wants the field to be queryable. This is achieved by storing the entered criterium in a variable in the pre-query trigger, and using it in the post-query trigger to exclude records. E.g.
pre-query ==> help_block.query_X := block.X;
post-query ==> if help_block.query_X is not null and block.X is null or not block.X like help_block.query then raise form_trigger_failure; end if;
- this works fine for "regular" search strings. However:
- whenever the search string starts with <, <=, >, >=, !, forms seems to interpret the leading characters before doing anything else. During pre-query, block.X is null, and as soon as I use it in pl/sql, I get FRM-40831: Truncation Occured: value too long for field. E.g.
user puts the following in block.X ==> '<X', so he wants to search for records with value '<X' (text; not 'smaller than ...')
pre-query => msg.show(block.X) ==> appears to be empty/null, but right after the message, I get FRM-40831 Truncation Occured: value too long for field ...
This only happens if < is the first non-space character in the search string.
Does anyone know of a way to prevent oracle from interpreting the <, <=, ... characters entered in enter-query mode?I'm sorry for not making myself clear; I'll give it another go:
The problem is that, if I enter '<abc' in a form field in enter-query mode (so during creation of the "example record"), forms immediately interprets the < as 'smaller than' and does some obscure things with it (my guess: converting to a where clause, but since I'm using a non db field, this actually does nothing), and finishes by erasing the field contents (in the example record). In the pre-query trigger, I can no longer get the '<abc' and store it. I want one of the following:
- prevent forms from interpreting the '<' in front (same thing happens for !=, <=, >=, =, ...)
or
- capture the entered string ('<abc') before forms reacts to the '<' in front
Edited by: [email protected] on Feb 17, 2009 12:30 PM -
How to assign special characters to select tags
Hi All,
Just wondering if anyone knows the correct html to assign a
special character like an ampersand or greater than/less than sign
to a select tag?
<select>
<option value ="volvo & bmw">Misc Prestige
Cars</option>
<option value ="saab">Saab</option>
<option value ="opel">Opel</option>
<option value ="audi">Audi</option>
</select>put & as & > as > and < as <
So it will be...
<option value ="volvo & bmw">Misc Prestige
Cars</option> -
Reg truncating special characters in BEx Query
Hi
While I try to run a query ,for some Account nos I get
IBL/5556262
#/43434434
I want to remove IBL/ and #/ in my query and just display
5556262
43434434
How do I do it in my Query designer?Kindly need your inputs
Thanks
Bharathraj.NHi,
You are getting this because it has compounded characteristic.
Say char1 has char2 as compounding attribute.
Now when u drag char1 in query, char2 also gets dropped.
You can avoid this, if u want only specific value for char2 (say IBL).
Remove char2 from characteristics and place it in filter with value restricted to IBL.
Hope this is clear,
Shylaja. -
How to check multiple special characters in instr function sql query.
Hi,
The following special characters are comma(,), slash(/), colan(:)
these special characters i need to be check in instr function.
select SUBSTR(master_title,1,INSTR(master_title,',',1,1)-1) from dual;
Can you please write the query with right answer.
Thanks in advance,
Lakshman.Why multiple post?
How to check multiple special characters in this query. -
How to ignore special characters in Logical SQL.
Hi Experts,
I am using Logical SQL generated from BI Answers in dataset of BIP Data model.
The column name or presentation table name contains special character as “&, %’
So when I try to create dataset using suppose following Logical SQL, I am getting prompt/error as
“Please enter values for lexical references in SQL
*~ description"."security name" s_9, ”
Could you please suggest what should I do to ignore these special characters?
SELECT
0 s_0,
"TEST_RPD"."Account"."As Of Date" s_1,
"TEST_RPD"."Security Identifier & Description"."Security Name" s_9,
"TEST_RPD"."Statistics"."Quality - S&P Rating" s_26,
"TEST_RPD"."Statistics"."Yield To Maturity" s_27
FROM "TEST_RPD"
WHERE
(("Account"."As Of Date" = date '2011-01-31') AND ("Account"."Report Account ID" = '1733'))Thanks..That is what we did in RPD.
I was looking for any other approach as our RPD is shared between OBIEE and BIP. -
Read in xml special characters
Hi,
I have PL/SQL block to read in a xml file from a URL. I manage to store it perfectly fine. The problem is that I have problems reading in special characters when selecting the view. Any help please? Here is my code:
DECLARE
req utl_http.req;
resp utl_http.resp;
myvalue blob;
myclob blob;
feedtype number;
BEGIN
Select id into feedtype
from feednames
where name = 'EA';
req := utl_http.begin_request('http://cput-ep ap04.work.com:8852/test/gne.xml');
resp := utl_http.get_response(req);
LOOP
utl_http.read_line(resp, myvalue, TRUE);
myclob := myclob || convert(myvalue, 'UTF8', 'WE8ISO8859P1');
END LOOP;
utl_http.end_response(resp);
commit;
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
Delete from feeds where id = feedtype;
insert into feeds values (feedtype,xmltype(myclob));
commit;
END;
The view that I have created is:
create or replace view GM as
select
extractvalue(value(d), '/article/@article_id') id,
extract(value(d), '/article/@article_title').getclobval() title,
extractvalue(value(d), '/article/@article_descrip') description
from feeds x,
table(xmlsequence(extract(x.DATA_XML, '/article_elements/article'))) d where x.ID = 7How about some sample data? The Url you gave has a space in it and is not public available. What's the error message you got?
-
Stopping select query to fetch entries containing special characters
Hi Friends,
I want a way by which my select query does not bring those entries which contains any special characters present in those records.
Eg:
MATNR
PC1----
ALLOWED
PC2----
ALLOWED
PC3-1-2----
NOT ALLOWED
PC4_5_3-------NOT ALLOWED
I wrote
where matnr not like '%-%'
and it works but for underscore it doesnt..also if u can tell me to obstruct those records which contains any special characters from DB.
Thanks and Regards,
GauravHi,
First fetch it from the database..
Then check if it contains any '_' By using 'CA"...
delete those records ...
Loop at itab into wa.
if wa-matnr CA '_'. <------ You can also use 'CS'
wa_itab-matnr = wa-matnr.
append wa_itab to itab2.
endloop.
delete itab where matnr in itab2. -
How to find Special Characters in a single query
Dear Experts,
Your usual help is required to solve the query.My query is "How to find all special characters like (%$*&@,;'/+- etc. in a single query?"
Thanks.
e.g.
A_MIR
A%SIM
A*SIM
A)SIMHi,
947459 wrote:
Dear Experts,
Your usual help is required to solve the query.My query is "How to find all special characters like (%$*&@,;'/+- etc. in a single query?"
Thanks.
e.g.
A_MIR
A%SIM
A*SIM
A)SIMIt's not clear what you want.
What are "special characters"? Can you list all of them?
Do you want to find rows where string_column contains any of the special characters? If so
SELECT string_column
FROM table_x
WHERE string_column != NVL ( TRANSLATE ( string_column
, 'A(%$*&@,;'/+-'
, 'A'
, 'A'
;I assume 'A' is not a special character.
You could also use regular expressions, but it will be more efficient if you don't use them unless you really need to.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002}
You'll get better replies sooner if you always include this information whenever you have a question. -
How to escape the special character ' (ascii 39) in a select query?
Hi,
does anybody know how to escape the special character ' (ascii 39) in a select query?
I've tried a lot of ways but nothing seems to work, for example I try to get all
names in table foo where coloumn name contains a '-sign (ascii 39)
select name from foo where name like '%\'%';
select name from foo where name like '%{'}%';
select name from atg_horse where name like '%chr(39)%'
... but neither works, I end up with a ORA-01756: quoted string not properly terminated
I would apriciate any help
/Carl-Michaelfriends
thanks for ur time and effort that u gave to reply to my problem.
But my main problem is that when my application (VC++ 7) fires the following query in the oracle database , it does not return any rows.
SELECT count(*) FROM ORGANISATION WHERE UPPER(ORGANISATION.ORGANISATIONNAME)
LIKE N'β%' ORDER BY ORGANISATION.ORGANISATIONNAME
the above question in the previous thread was just to check on sql plus as it's editor does not support unicode characters. -
Oracle SQL query for getting specific special characters from a table
Hi all,
This is my table
Table Name- Table1
S.no Name
1 aaaaaaaa
2 a1234sgjghb
3 a@3$%jkhkjn
4 abcd-dfghjik
5 bbvxzckvbzxcv&^%#
6 ashgweqfg/gfjwgefj////
7 sdsaf$([]:'
8 <-fdsjgbdfsg
9 dfgfdgfd"uodf
10 aaaa bbbbz#$
11 cccc dddd-/mnm
The output has to be
S.no Name
3 a@3$%jkhkjn
5 bbvxzckvbzxcv&^%#
7 sdsaf$([]:'
8 <-fdsjgbdfsg
10 aaaa bbbbz#$
It has to return "Name" column which is having special characters,whereas some special chars like -, / ," and space are acceptable.
The Oracle query has to print columns having special characters excluding -,/," and space
Can anyone help me to get a SQL query for the above.
Thanks in advance.You can achieve it in multiple ways. Here are few.
SQL> with t
2 as
3 (
4 select 1 id, 'aaaaaaaa' name from dual union all
5 select 2 id, 'a1234sgjghb' name from dual union all
6 select 3 id, 'a@3$%jkhkjn' name from dual union all
7 select 4 id, 'abcd-dfghjik' name from dual union all
8 select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
9 select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
10 select 7 id, 'sdsaf$([]:''' name from dual union all
11 select 8 id, '<-fdsjgbdfsg' name from dual union all
12 select 9 id, 'dfgfdgfd"uodf' name from dual union all
13 select 10 id, 'aaaa bbbbz#$' name from dual union all
14 select 11 id, 'cccc dddd-/mnm' name from dual
15 )
16 select *
17 from t
18 where regexp_like(translate(name,'a-/" ','a'), '[^[:alnum:]]');
ID NAME
3 a@3$%jkhkjn
5 bbvxzckvbzxcv&^%#
7 sdsaf$([]:'
8 <-fdsjgbdfsg
10 aaaa bbbbz#$
SQL> with t
2 as
3 (
4 select 1 id, 'aaaaaaaa' name from dual union all
5 select 2 id, 'a1234sgjghb' name from dual union all
6 select 3 id, 'a@3$%jkhkjn' name from dual union all
7 select 4 id, 'abcd-dfghjik' name from dual union all
8 select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
9 select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
10 select 7 id, 'sdsaf$([]:''' name from dual union all
11 select 8 id, '<-fdsjgbdfsg' name from dual union all
12 select 9 id, 'dfgfdgfd"uodf' name from dual union all
13 select 10 id, 'aaaa bbbbz#$' name from dual union all
14 select 11 id, 'cccc dddd-/mnm' name from dual
15 )
16 select *
17 from t
18 where translate
19 (
20 lower(translate(name,'a-/" ','a'))
21 , '.0123456789abcdefghijklmnopqrstuvwxyz'
22 , '.'
23 ) is not null;
ID NAME
3 a@3$%jkhkjn
5 bbvxzckvbzxcv&^%#
7 sdsaf$([]:'
8 <-fdsjgbdfsg
10 aaaa bbbbz#$
SQL> -
Query to Handle special characters in the conditions
Hi all,
We have a table for colour codes and there related information but the colour codes have special characters in them like
AL&.MPD
CH(SB00
ECA&BC1
TD..0023
0O'DON4
i need to check if these exist in the table or not but when i query like
select * from art.tb_color_code where color_code in ('AL&.MPD','CH(SB00','ECA&BC1','TD..0023','0O'DON4');
i get prompts for entering the variable values there are 2500 such codes
how do i negate the special meanings of these characters
Regards
MaverickHi,
If a string literal contains an apostrophe, use two consecutive apostrophes.
For example:
'0O''DON4'is a seven-character string. The third character is an apostrophe.
As others have said,
SET DEFINE OFFwill disable the special meaning of & in SQL*Plus. -
Dynamic SQL Query to Find Special Characters in Table columns
Hi,
I am new to OTN FORUMS.
I am trying to find the columnsi of a table which have special characters in them.
I am planning on using this query
select ' select INSTR('||column_name||', chr(0))
from '||table_name||'where INSTR('||column_name||', chr(0)) >0' from user_tab_columns
where table_name='Account'
and spool the output to run as a script.
Is this the right way or do u suggest any modifications to the query?
Thanks in advance.Hi,
I think your basic approach is right. Since you can't hard-code the table- or column names into the query, you'll need dynamic SQL.
Instead SQL-from-SQL (that is, writing a pure SQL query, whose output is SQL code), you could do the whole job in PL/SQL, but I don't see any huge advantage either way.
When you say "Special character<b>s</b>", do you really mean "one given special character" (in this case, CHR(0))?
Will you ever want to search for multiple special characters at once?
What if table foo has a column bar, and in 1000 rows of foo, bar contains CHR (0). Do you want 1000 rows of output, each showing the exact position of the first CHR(0)? If the purpose is to look at theese rows later, shouldn't you include the primary key in the output? What if CHR(0) occurs 2 or more times in the same string?
If you'd rather have one row of output, that simply says that the column foo.bar sometimes contains a CHR(0), then you could do something like this:
SELECT 'foo', 'bar'
FROM dual
WHERE EXISTS (
SELECT NULL
FROM foo
WHERE INSTR ( bar
, CHR (0)
) > 0
); -
Find out the sql query for special characters.
Hi,
I have the emp table with column name first_name.In that table i have lot records with first_name inlcudes the below mentioned special characters.
¡ , ¿, ,Ä,Å,ä,ª,À,Á,Ã,à,á,ã,å,Æ,æ,Ç,ç,È,É,Ê,Ë,è,é,ê,ë,Ì,Í,Î, Ï,ì,í,î,ï, Ñ,ñ, ô, º, Ò, Ó, Ô, Õ, Ö, Ø, ò, ó, õ, ö, ø, ß, Û, Ù, Ú, Ü,ù, ú, û, ü, ÿ,
I am looking for the records with includes the above mentioned special characters in the first_name column.
Can u please give the sql query to find out the records.
Thanks&Regards
N.SivaramanI am looking for the records with includes the above mentioned special characters in the first_name column.One way would be:
select emp.*
from emp,
table (
sys.odcivarchar2list ('¡',
'Ä',
'Å',
'ä',
'ª',
'À',
'Á',
'Ã',
'à',
'á',
'ã',
'å',
'Æ',
'æ',
'Ç',
'ç',
'È',
'É',
'Ê',
'Ë',
'è',
'é',
'ê',
'ë',
'Ì',
'Í',
'Î',
'Ï',
'ì',
'í',
'î',
'ï',
'Ñ',
'ñ',
'ô',
'º',
'Ò',
'Ó',
'Ô',
'Õ',
'Ö',
'Ø',
'ò',
'ó',
'õ',
'ö',
'ø',
'ß',
'Û',
'Ù',
'Ú',
'Ü',
'ù',
'ú',
'û',
'ü',
'ÿ'
where instr (ename, column_value) > 0
Maybe you are looking for
-
I can not view ANY videos on Vimeo, I have 'reset' the Ipad, original IOS 5, cleared the history and cookies, I haves changed the DNs number to 8.8.8.8, I have worked on this for 3 days now, HELP!!!!
-
Passing bean as attribute to servlet in request scope
Hello, I want to pass a bean from a jsp to my controller servlet. As I understood, as long as I can give the bean 'request' scope, then I should be abble to access the bean, as an attribute in the doPost / doGet method of my servlet. However, when I
-
Media Card Issues...P​lease Help
About a week ago I could not save anything to my media card. I put everything on my computer so I need to reformat my card and get it working again. When I try to format it I get "Media Card Format Failed" What should I do?
-
Shared mailbox conversation view; on behalf sent items
Update rollup 4 for SP2 introduced the possibility to have a sent item stored in the shared mailbox on behalf of who you sent it. Now this works ok, sent items in fact are saved in the sent items folder of the shared mailbox. But if you put that shar
-
Can I use iSight to stream on ustream.tv?
I tried searching the topics here but couldn't find an answer. Anybody know if you can use the iSight camera to stream live on ustream.tv?? Thanks!