SQL query for zero or more than 1 row
have 2 tables Table1 and Table2
Table1 contains one varchar2 column Col1 with values: id1, id2, id3, id4, .....id9
Table2 contains two varchar2 columns with values:
Col1 Col2
id1 some1
id1 some2
id3 some3
id4 some4
id9 some5
id9 some6
Table1 and Table2 join on Table1.col1 = Table2.col1
I want to find those rows in Table1 that have zero or more than one values in Table2
So the output in the above case would be
id1 (since it has more than one corresponding values in Table2)
id2 (since it does not have corresponding value in Table2)
id9 (since it has more than one corresponding values in Table2)
One way:
select table1.col1
from table1 left outer join table2 on table1.col1 = table2.col1
group by table1.col1 having count(table2.col1) != 1
Where there is no match, table2.col1 in the outer join will be null, so the count will be zero.
Where there are multiple matches the count will be > 1.
Untested because you didn't supply table and data creation scripts. See Re: 2. How do I ask a question on the forums?
Similar Messages
-
Problem writing a sql query for a select list based on a static LOV
Hi,
I have the following table...
VALIDATIONS
ID Number (PK)
APP_ID Number
REQUESTED Date
APPROVED Date
VALID_TIL Date
DEPT_ID Number (FK)
I have a search form with the following field item variables...
P11_DEPT_ID (select list based on dynamic LOV from depts table)
P11_VALID (select list based on static Yes/No LOV)
A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
SELECT v.APP_ID,
v.REQUESTED,
v.APPROVED,
v.VALID_TIL,
d.DEPT
FROM DEPTS d, VALIDATIONS v
WHERE d.DEPT_ID = v.DEPT_ID(+)
AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
Can anyone help me to extend my query to include this situation?
Thanks.Hello !
Let's have a look at my example:create table test
id number
,valid_til date
insert into test values( 1, sysdate-3 );
insert into test values( 2, sysdate-2 );
insert into test values( 3, sysdate-1 );
insert into test values( 4, sysdate );
insert into test values( 5, sysdate+1 );
insert into test values( 6, sysdate+2 );
commit;
select * from test;
def til=yes
select *
from test
where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
=decode('&til','yes',1,-1);
def til=no
select *
from test
where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
=decode('&til','yes',1,-1);
drop table test; It's working fine, I've tested it.
The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
For understandings:
1.) TRUNC removes the time part of DATE
2.) The difference of to date-values is the number of days between.
3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
4.) DECODE is like an IF.
Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
Good luck,
Heinz -
Create pagination for table contain more than 2 PK
Guys;
Is there any way to use the wizard for creating FORM PAGINATION for tables having more than 2 PK??
Regards;Hi dimitri;
after the user login & start using this form thiswhat should happen to these 3 PKs:
-1st PK will be a unique number for the questions.
-2nd PK should be the ID for each survey ( created as global variable in Zero Page ).
-3rd PK will be the division for this user (also created as a global variable in ZERO PAGE)..so this is the only field which will nt be changed while the user is logged..
i tried to use the 1st 2 PKs...& set the last one to get a default value..it worked in the begining but gave me the 1st record for each Survey but my problem that i couldnt navigate to the 2nd record..& after that once i log out & relogin it willnt give me anything.
Regards;
ehammad -
QUERY FOR HOW TO ACCESS NEXT ROW WHILE IN CURRENT ROW
Hi, can you please make a oracle sql query for the following.
My Data in table dt0attlog:
ID staffid logdt login logout
01 aw101 01.12.11 01.12.11 08.30
01 aw101 01.12.11 01.12.11 10.30
01 aw101 01.12.11 01.12.11 11.40
01 aw101 01.12.11 01.12.11 14.30
01 aw101 01.12.11 01.12.11 15.00
01 aw101 01.12.11 01.12.11 17.45
01 aw102 01.12.11 01.12.11 19.20
01 aw102 01.12.11 01.12.11 20.30
01 aw102 01.12.11 01.12.11 21.50
01 aw102 01.12.11 01.12.11 23.10
01 aw102 01.12.11 01.12.11 23.20
01 aw102 02.12.11 02.12.11 07.00
01 aw102 02.12.11 02.12.11 18.00
01 aw102 03.12.11 03.12.11 04.30
01 aw103 01.12.11 01.12.11 09.40
01 aw104 01.12.11 01.12.11 18.00
My required output:
ID staffid logdt login logout diff-in-seconds
01 aw101 01.12.11 01.12.11 08.30 01.12.11 10.30 7200
01 aw101 01.12.11 01.12.11 11.40 01.12.11 14.30 10200
01 aw101 01.12.11 01.12.11 15.00 01.12.11 17.45 9900
01 aw102 01.12.11 01.12.11 19.20 01.12.11 20.30 4200
01 aw102 01.12.11 01.12.11 21.50 01.12.11 23.10 4800
01 aw102 01.12.11 01.12.11 23.20 02.12.11 07.00 27600
01 aw102 02.12.11 02.12.11 18.00 03.12.11 04.30 37800
01 aw103 01.12.11 01.12.11 09.40
01 aw104 01.12.11 01.12.11 18.00
Here record aw102 & dt. 01.12.11 / 02.12.11, it should shows the next day out in
the current date ie. 01.12.11.
thanks and await your great help please.the followings are the testcase
SQL> create table dt0device (
2 deviceid varchar2(15),
3 staffid varchar2(10),
4 logdt date,
5 in_out_flag varchar2(3));
Table created.
SQL> insert into dt0device values('01','aw101',to_date('01.12.2011 08:30','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw101',to_date('01.12.2011 10:30','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL> insert into dt0device values('01','aw101',to_date('01.12.2011 11:40','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw101',to_date('01.12.2011 14:30','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL> insert into dt0device values('01','aw101',to_date('01.12.2011 15:00','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw101',to_date('01.12.2011 17:45','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL>
SQL> insert into dt0device values('01','aw102',to_date('01.12.2011 19:20','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw102',to_date('01.12.2011 20:30','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL> insert into dt0device values('01','aw102',to_date('01.12.2011 21:50','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw102',to_date('01.12.2011 23:10','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL> insert into dt0device values('01','aw102',to_date('01.12.2011 23:20','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw102',to_date('02.12.2011 07:00','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL> insert into dt0device values('01','aw102',to_date('02.12.2011 18:00','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw102',to_date('03.12.2011 04:30','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL>
SQL> insert into dt0device values('01','aw103',to_date('01.12.2011 09:40','DD/MM/RRRR HH24.MI'),'IN');
1 row created.
SQL> insert into dt0device values('01','aw104',to_date('01.12.2011 18:00','DD/MM/RRRR HH24.MI'),'OUT');
1 row created.
SQL> create table dt0attlogdevice
2 ( staffid varchar2(10),
3 logdt date,
4 login date,
5 logout date);
Table created.
SQL> insert into dt0attlogdevice select staffid,logdt,
2 decode(in_out_flag,'IN',logdt,null) login,
3 decode(in_out_flag,'OUT',logdt,null) logout
4 from dt0device;
16 rows created.
SQL> select staffid,to_char(logdt,'DD/MM/RR') logdt, to_char(login,'DD/MM/RR HH24.MI') login,
2 to_char(logout,'DD/MM/RR HH24.MI') logout
3 from dt0attlogdevice;
STAFFID LOGDT LOGIN LOGOUT
aw101 01/12/11 01/12/11 08.30
aw101 01/12/11 01/12/11 10.30
aw101 01/12/11 01/12/11 11.40
aw101 01/12/11 01/12/11 14.30
aw101 01/12/11 01/12/11 15.00
aw101 01/12/11 01/12/11 17.45
aw102 01/12/11 01/12/11 19.20
aw102 01/12/11 01/12/11 20.30
aw102 01/12/11 01/12/11 21.50
aw102 01/12/11 01/12/11 23.10
aw102 01/12/11 01/12/11 23.20
STAFFID LOGDT LOGIN LOGOUT
aw102 02/12/11 02/12/11 07.00
aw102 02/12/11 02/12/11 18.00
aw102 03/12/11 03/12/11 04.30
aw103 01/12/11 01/12/11 09.40
aw104 01/12/11 01/12/11 18.00
16 rows selected.
===
from the above table , I want to generate ouput as below:
staffid logdt login logout diff-in-seconds
aw101 01.12.11 01.12.11 08.30 01.12.11 10.30 7200
aw101 01.12.11 01.12.11 11.40 01.12.11 14.30 10200
aw101 01.12.11 01.12.11 15.00 01.12.11 17.45 9900
aw102 01.12.11 01.12.11 19.20 01.12.11 20.30 4200
aw102 01.12.11 01.12.11 21.50 01.12.11 23.10 4800
aw102 01.12.11 01.12.11 23.20 02.12.11 07.00 27600
aw102 02.12.11 02.12.11 18.00 03.12.11 04.30 37800
aw103 01.12.11 01.12.11 09.40
aw104 01.12.11 01.12.11 18.00
Here record aw102 & dt. 01.12.11 / 02.12.11, it should shows the next day out in
the current date ie. 01.12.11.
I dont know how to make query for the above output.
please help me. -
How to write sql query for below example.
Hi,
I have requirement.
There are number of rows and I need the result through query as follows.Please help me to proved sql query for below mentioned requirement.
example: table TEST.
COLA COLB COLC COLD
MANAGER 5 NULL null
SR.MANAGE 6 3 NULL
VP 5 5 4
I have to write the sql query if COLA IS MANAGER THEN CONSIDER MANGER RECORD,AND IF ANY COLUMN FILED IS NULL FOR MANGER THEN CONSIDER COLA IS SR.MANGER, AND IF ANY COLUMN FILED IS NULL FOR SR,MANGER THEN CONSIDER VP records.
I need output as below.
COLB COLC COLD
5(MANGER) 3(sr.manger) 5(vp)
Please provide the for above mentioned output.
Thanks<<if COLA IS MANAGER THEN CONSIDER MANGER RECORD>>
What does this sentence means? COLA does not cnatin a single record but the number of records with diffrent values.
Regards
Arun -
How to write sql query for below mentioned eaxmple.
Hi,
I have requirement.
There are number of rows and I need the result through query as follows.Please help me to proved sql query for below mentioned requirement.
example: table TEST.
COLA COLB COLC COLD COLE COLF MANAGER 5 NULL NULL 3 NULL
SR.MANAGER 6 3 NULL NULL NULL
VP 5 5 4 5 5
I have to write the sql query if COLA IS MANAGER THEN CONSIDER MANGER RECORD,AND IF ANY COLUMN FILED IS NULL FOR MANGER THEN CONSIDER COLA IS SR.MANGER, AND IF ANY COLUMN FILED IS NULL FOR SR,MANGER THEN CONSIDER VP records.
I need output as below.
COLB COLC COLD COLE COLF
5(manager) 3(sr.manger) 4(vp) 3(manger) 3(vp)
Please provide the for above mentioned output.
ThanksDuplicate thread. please view the answer posted in your first thread.
how to write sql query.
And, please don't post any duplicate thread.
Regards.
Satyaki De. -
I want sql query for this output
hi guys
could u tell how can i write sql query for this out put
i have one table like this
ID ACCOUTID TAX
1 1 A
2 1 B
3 2 C
4 2 D
5 3 E
7 NULL F
8 NULL G
MY OUT PUT MUST BE LIKE THIS
ID AID TAX
2 1 A
4 2 D
7 NULL F
8 NULL G
HERE IN THIS OUTPUT I SHOULD HAVE
MAXIMAM ID VALUE FOR A REPEATED AID VALUES
AND
THE ROWS AID VALUES IS NULL ALSO MUST PAPULATED IN THE OUTPUT.
I KNOW ONE SOLUTION LIKE THIS
SELECT MAX(ID),AID,TAX
FROM TABLE T
GROUP BY AID,TAX
UNION ALL
SELECT ID, AIC,TAX
FROM TABLE T
WHERE AID IS NULL;
BUT I WANT SAME RESULT WITH OUT USING LOGICAL OPERATORS.
COULD U PLZ TELL A SOL.Will this help:
SQL> with t as
2 (
3 select 1 ID, 1 ACCOUTID, 'A' TAX from dual union all
4 select 2, 1, 'B' from dual union all
5 select 3, 2, 'C' from dual union all
6 select 4, 2, 'D' from dual union all
7 select 5, 3, 'E' from dual union all
8 select 7, NULL, 'F' from dual union all
9 select 8, NULL, 'G' from dual
10 )
11 --
12 select id, ACCOUTID AID, Tax
13 from
14 (
15 select t.*
16 ,count(1) over (partition by t.ACCOUTID) cn
17 ,row_number() over (partition by t.ACCOUTID order by id desc) rn
18 from t
19 )
20 where cn > 1
21 and (rn = 1 or ACCOUTID is null)
22 /
ID AID T
2 1 B
4 2 D
8 G
7 F
-- If I leave out the OR condition then you'll get this:
SQL> ed
Wrote file afiedt.buf
1 with t as
2 (
3 select 1 ID, 1 ACCOUTID, 'A' TAX from dual union all
4 select 2, 1, 'B' from dual union all
5 select 3, 2, 'C' from dual union all
6 select 4, 2, 'D' from dual union all
7 select 5, 3, 'E' from dual union all
8 select 7, NULL, 'F' from dual union all
9 select 8, NULL, 'G' from dual
10 )
11 --
12 select id, ACCOUTID AID, Tax
13 from
14 (
15 select t.*
16 ,count(1) over (partition by t.ACCOUTID) cn
17 ,row_number() over (partition by t.ACCOUTID order by id desc) rn
18 from t
19 )
20 where cn > 1
21* and rn = 1
SQL> /
ID AID T
2 1 B
4 2 D
8 G
--which follows the description you've given, but not the output -
ORA-00494: enqueue [CF] held for too long (more than 900 seconds)
Hi ,
I am getting this error , the database is in no archive mode and there is frequent log switch.
However following few metalink notes I have set the hidden parameters like
killcontrolfile_enqueue_blocker=false
killenqueue_blocker=1
I wanted to reduce the frequece log switch how to reduce it.
ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1One way is to make the size of the redo logs bigger and another way is to do some less work :)
Changing Redo Log File SizesEach Redo Log File member in a Group must be identical in size. If you need to make your Redo Log Files larger, use the following steps.
1. Use the V$LOG view to identify the current active Redo Log Group.
SQL> SELECT group#, status FROM v$log;
GROUP# STATUS
1 INACTIVE
2 INACTIVE
3 CURRENT
4 INACTIVE
2. Drop one or more of the inactive Redo Log Groups keeping at least two current On-line Redo Log Groups.
3. Use operating system commands to delete the files that stored the dropped Redo Log Files.
4. Recreate the groups with larger file sizes. Continue this sequence until all groups have been resized.
Edited by: TSharma on Jan 17, 2013 11:52 AM -
Error while executing a sql query for select
HI All,
ORA-01652: unable to extend temp segment by 128 in tablespace PSTEMP i'm getting this error while i'm executing the sql query for selecting the data.I am having 44GB of temp space, while executing the below query my temp space is getting full, Expert please let us know how the issue can be resolved..
1. I dont want to increase the temp space
2. I need to tune the query, please provide your recomendations.
insert /*+APPEND*/ into CST_DSA.HIERARCHY_MISMATCHES
(REPORT_NUM,REPORT_TYPE,REPORT_DESC,GAP,CARRIED_ITEMS,CARRIED_ITEM_TYPE,NO_OF_ROUTE_OF_CARRIED_ITEM,CARRIED_ITEM_ROUTE_NO,CARRIER_ITEMS,CARRIER_ITEM_TYPE,CARRIED_ITEM_PROTECTION_TYPE,SOURCE_SYSTEM)
select
REPORTNUMBER,REPORTTYPE,REPORTDESCRIPTION ,NULL,
carried_items,carried_item_type,no_of_route_of_carried_item,carried_item_route_no,carrier_items,
carrier_item_type,carried_item_protection_type,'PACS'
from
(select distinct
c.REPORTNUMBER,c.REPORTTYPE,c.REPORTDESCRIPTION ,NULL,
a.carried_items,a.carried_item_type,a.no_of_route_of_carried_item,a.carried_item_route_no,a.carrier_items,
a.carrier_item_type,a.carried_item_protection_type,'PACS'
from CST_ASIR.HIERARCHY_asir a,CST_DSA.M_PB_CIRCUIT_ROUTING b ,CST_DSA.REPORT_METADATA c
where a.carrier_item_type in('Connection') and a.carried_item_type in('Service')
AND a.carrier_items=b.mux
and c.REPORTNUMBER=(case
when a.carrier_item_type in ('ServicePackage','Service','Connection') then 10
else 20
end)
and a.carrier_items not in (select carried_items from CST_ASIR.HIERARCHY_asir where carried_item_type in('Connection') ))A
where not exists
(select *
from CST_DSA.HIERARCHY_MISMATCHES B where
A.REPORTNUMBER=B.REPORT_NUM and
A.REPORTTYPE=B.REPORT_TYPE and
A.REPORTDESCRIPTION=B.REPORT_DESC and
A.CARRIED_ITEMS=B.CARRIED_ITEMS and
A.CARRIED_ITEM_TYPE=B.CARRIED_ITEM_TYPE and
A.NO_OF_ROUTE_OF_CARRIED_ITEM=B.NO_OF_ROUTE_OF_CARRIED_ITEM and
A.CARRIED_ITEM_ROUTE_NO=B.CARRIED_ITEM_ROUTE_NO and
A.CARRIER_ITEMS=B.CARRIER_ITEMS and
A.CARRIER_ITEM_TYPE=B.CARRIER_ITEM_TYPE and
A.CARRIED_ITEM_PROTECTION_TYPE=B.CARRIED_ITEM_PROTECTION_TYPE
AND B.SOURCE_SYSTEM='PACS'
Explain Plan
==========
Plan
INSERT STATEMENT ALL_ROWSCost: 129 Bytes: 1,103 Cardinality: 1
20 LOAD AS SELECT CST_DSA.HIERARCHY_MISMATCHES
19 PX COORDINATOR
18 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10002 :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1
17 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1
15 HASH JOIN RIGHT ANTI NA PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,098 Cardinality: 1
4 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 63 Bytes: 359,283 Cardinality: 15,621
3 PX SEND BROADCAST PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621
2 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621
1 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621
14 NESTED LOOPS ANTI PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 40,256,600 Cardinality: 37,448
11 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 6,366,160 Cardinality: 37,448
8 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1002
7 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 1 Bytes: 214 Cardinality: 2
6 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 1 Bytes: 214 Cardinality: 2
5 INDEX FULL SCAN INDEX CST_DSA.IDX$$_06EF0005 Cost: 1 Bytes: 214 Cardinality: 2
10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448
9 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448
13 TABLE ACCESS BY INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT CST_DSA.HIERARCHY_MISMATCHES :Q1002Cost: 0 Bytes: 905 Cardinality: 1
12 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT SYS.HIERARCHY_MISMATCHES_IDX3 :Q1002Cost: 0 Cardinality: 1
16 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT CST_DSA.IDX$$_06EF0001 :Q1002Cost: 1 Bytes: 5 Cardinality: 1 -
How can I search for files with more than one keyword?
I´ve created some keywords, and some files in my folder are tagged with two, three or more keywords.
Is there a way to search for files using more than one keyword on the search field?
Thanks!Use the Find command (menu Edit) and in criteria at the right side is a plus sign to add another criteria and set it to your custom wishes.
make a choice in results and you should be OK -
Can I run my creative cloud for teams on more than one computer?
Can I run my creative cloud for teams on more than one computer?
Hi Nick,
We would like to inform you that you can install and activate the subscription on 2 machines, however, you cannot use both of them at the same time.
Kindly check the point 1.1 from the below mentioned link.
http://wwwimages.adobe.com/content/dam/Adobe/en/legal/servicetou/Software_Terms-en_US-2015 0407_2200.pdf
Thanks,
Atul Saini -
Extracting the Logical sql query for the specified report in OBIEE 11g
Hi ,
I want to extract the logical SQL Query for the Particular report in OBIEE 11.1.1.5.
Any pointers related to this will be very helpful.
Thanks,
Sonalifor a try please add Logical sql view to ur report it will dispaly the Logical sql for that Report..
Hope it will helps you. -
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 Builder accepts not more than 60 fields in a single dataset
Query Builder accepts not more than 60 fields in a single dataset. Once we try to enter 61st field - it pops up with a message. Is there some setting that we need to change.
Please help me.
Thanx & Regards,
Rajeev GoelQuery Builder accepts not more than 60 fields in a single dataset. Once we try to enter 61st field - it pops up with a message. Is there some setting that we need to change.
Please help me.
Thanx & Regards,
Rajeev Goel -
Lync BToE - USB HeartBeat is not passed from Lync for long duration (more than 20 seconds)
Lync BToE - USB HeartBeat is not passed from Lync for long duration (more than 20 seconds)
Hi,
Did the issue happen only for you or for multiple users?
Make sure phone update to the latest firmware.
Best Regards,
Eason Huang
Eason Huang
TechNet Community Support
Maybe you are looking for
-
How do you use the edit function after you PAY $25 to use the form fill function
-
Data not arriving in oracle lite using qbased syncing
Hi, I am currently having difficulty adding new publication Items to our current queue based syncing in Oracle lite. I have set up the Queue using : createQueuePublicationItem I have set up the Index using : createPublicationItemIndex I have added th
-
HELP!!! wwctx_api.get_user
I created a PL/SQL Server Page just to show the login information from a login portlet. The code follows: <%@ page language="PL/SQL" %> <%@ plsql procedure="logininfo" %> <HTML> <HEAD><TITLE>This is a PSP Page!</TITLE></HEAD> <BODY> <% declare myname
-
IF I rent a move through itunes in the uk can I watch it when I go abroad? And do I need an Internet connection?
-
Initiate BPEL process by e-mail polling lost in upgrade to 11g
So, as you would know by a simple search, "e-mail polling" or e-mail as an activation agent in BPEL 10.x works wonderfully following the guidance in the link: http://blogs.bpel-people.com/2007/01/using-email-to-initiate-bpel-process.html. Taking that