Oracle query for getting discrepancy equip codes
I need help in getting a query for discrepancy equip_code
select distinct eq.dept_id,eq.drive_id,equip_code,eq.qc_subtype_id,staff_id
from qc_equipment_used eq, qc_daily qc
where eq.drive_id = qc.drive_id
and trunc(eq.create_time) = '06-aug-2012'
and out_of_service = 'N'
and eq.qc_subtype_id in (1026,1012)
and eq.drive_id = 'DRV2016637'
DEPT_ID|DRIVE_ID|EQUIP_CODE|QC_SUBTYPE_ID|STAFF_ID
95|DRV2016637|HEMORYA121|1012|0011
95|DRV2016637|HEMORYA121|1026|0011
95|DRV2016637|HEMORYA148|1012|0011
I need help in getting a query to show the user that
95|DRV2016637|HEMORYA148|1012|0011
was qc'd in the morning but not in the evening for 1026
You still refuse to read {message:id=9360002} and follow the Forum Etiquette?
How sad for you, since less volunteers will help you.
Similar Messages
-
Query for getting records max reported timestamp and 2nd max report
query for getting records in between
max reported timestamp and 2nd max reported timestamp
HERE IS ALL RESULT SET
TIME DOMAIN
30:jun:2006:20:08:45 TOMCAT
30:jun:2006:20:08:45 TOMCAT
30:jun:2006:20:07:04 TOMCAT
30:jun:2006:20:07:04 TOMCAT
30:jun:2006:20:07:24 TOMCAT
30:jun:2006:20:07:24 TOMCAT
30:jun:2006:20:07:45 TOMCAT
30:jun:2006:20:07:45 TOMCAT
30:jun:2006:20:08:05 TOMCAT
30:jun:2006:20:07:04 TOMCAT
30:jun:2006:20:08:05 TOMCAT
PD_REPORTED_TIMESTAM PD_USER
30:jun:2006:20:08:25 TOMCAT
30:jun:2006:20:08:25 TOMCAT
30:jun:2006:20:08:45 TOMCAT
30:jun:2006:20:08:45 TOMCAT
30:jun:2006:20:07:24 TOMCAT
30:jun:2006:20:07:04 TOMCAT
30:jun:2006:20:07:24 TOMCAT
30:jun:2006:20:07:45 TOMCAT
30:jun:2006:20:07:45 TOMCAT
30:jun:2006:20:08:05 TOMCAT
30:jun:2006:20:08:05 TOMCAT
PD_REPORTED_TIMESTAM PD_USER
30:jun:2006:20:08:25 TOMCAT
30:jun:2006:20:08:25 TOMCAT
QUERY RESULT TO COME
TIME DOMAIN
TOMCAT 30:jun:2006:20:08:45
TOMCAT 30:jun:2006:20:08:45
TOMCAT 30:jun:2006:20:08:45
TOMCAT 30:jun:2006:20:08:45
Message was edited by:
user517983Hi,
can we write query like this.
1 select pd_user,PD_REPORTED_TIMESTAMP
2 from sp_process_detail_current spdc
3 where host_id='DSCP02469'and pd_user='TOMCAT'
4 and exists(
5 select PD_REPORTED_TIMESTAMP from sp_process_detail_current
6* having max(PD_REPORTED_TIMESTAMP)-spdc.PD_REPORTED_TIMESTAMP=0)
SQL> /
PD_USER PD_REPORTED_TIMESTAM
TOMCAT 30:jun:2006:20:08:45
TOMCAT 30:jun:2006:20:08:45
TOMCAT 30:jun:2006:20:08:45
TOMCAT 30:jun:2006:20:08:45 -
Query for getting all function and procedure inside the packages
hi All
Please provide me Query for getting all function and procedure inside the packages
thanksAs Todd said, you can use user_arguments data dictionary or you can join user_objects and user_procedures like below to get the name of the packaged function and procedure names.
If you are looking for the packaged procedures and functions source then use user_source data dictionary
select a.object_name,a.procedure_name from user_procedures a,
user_objects b
where a.object_name is not null
and a.procedure_name is not null
and b.object_type='PACKAGE'
and a.object_name=b.object_name -
Some one please provide query for getting REMIT TO ADDRESS details by using the column RA_CUSTOMER_TRX_ALL.REMIT_TO_ADDRESS_ID
try
select ct.remit_to_address_id,
raa_remit_ps.party_site_number,
raa_remit_loc.state,
ft_remit.territory_short_name,
ct.*
from ra_customer_trx_all ct,
hz_cust_acct_sites_all raa_remit,
hz_party_sites raa_remit_ps,
hz_locations raa_remit_loc,
fnd_territories_vl ft_remit
where 1 = 1
and ct.remit_to_address_id = raa_remit.cust_acct_site_id(+)
and raa_remit.party_site_id = raa_remit_ps.party_site_id(+)
and raa_remit_loc.location_id(+) = raa_remit_ps.location_id
and raa_remit_loc.country = ft_remit.territory_code(+) -
Query for getting Responsibility, Menu and submenus
Hi,
I need one query for getting Responsibilites, menus, submenus agian submenus like that..
Pls share the query any body have.
Thanks in advance,
Hanimi.See user487104's post in Re: How to check a function is accessible under responsibility? .
He has given a script to build the output. -
Oracle query for top two salary of each group departmentwise
oracle query for top two salary departmentwise
sigh...
But anyway,
Top-n queries:
http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2853107469873
and ofcourse lots of 'em here on OTN... -
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 for Getting previous date in oracle in specifc scenario
I have the below data in a table A which i need to insert into table B along with one compute column.
TABLE A:
Account_No | Balance | As_on_date
1001 |-100 | 1-Jan-2013
1001 |-150 | 2-Jan-2013
1001 | 200 | 3-Jan-2013
1001 |-250 | 4-Jan-2013
1001 |-300 | 5-Jan-2013
1001 |-310 | 6-Jan-2013
Table B:
In table B,there should be no of days to be shown when balance is negative and the date one which it has gone into negative.
So,for 6-Jan-2013,this table should show below data:
Account_No | Balance | As_on_date | Days_passed | Start_date
1001 | -310 | 6-Jan-2013 | 3 | 4-Jan-2013
Here,no of days should be the days when the balance has gone negative in recent time and not from the old entry.
I need to write a sql query to get the no of days passed and the start date from when the balance has gone negative.
I tried to formulate a query using Lag analytical function,but i am not getting how should i check the first instance of negative balance by traversing back using LAG function. Even the first_value function was given a try but not getting how to partition in it based on negative value.
Any help or direction on this will be really helpful.
ThanksI think you can apply the Tabibitoshan method here. The query is more complex but performs better than other methods. For an explanation, see Tabibitosan method tutorial by Aketi Jyuuzou
The idea behind the method is to identify "continuous" records without gaps. Here I identify records that are "continuous" because they contain an uninterrupted series of negative balances.
drop table t;
CREATE TABLE t (Account_No , Balance , As_on_date) AS SELECT
1001 ,-100 , to_date('1-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-150 , to_date('2-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 , 200 , to_date('3-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-250 , to_date('4-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-300 , to_date('5-Jan-13', 'DD-MON-YY') FROM dual UNION ALL SELECT
1001 ,-310 , to_date('6-Jan-13', 'DD-MON-YY') FROM dual;
SELECT Account_No, Balance, to_char(As_on_date, 'DD-MON-YYYY') as_on_date,
CASE
WHEN balance < 0
THEN row_number() OVER(PARTITION BY account_no, grp ORDER BY as_on_date)
END days_passed,
CASE
WHEN balance < 0
THEN to_char(
first_value(as_on_date) OVER(PARTITION BY account_no, grp ORDER BY as_on_date),
'DD-MON-YYYY'
end start_date
from (
SELECT Account_No, Balance, As_on_date,
CASE WHEN balance >= 0 THEN NULL ELSE
row_number() OVER(PARTITION BY account_no ORDER BY as_on_date) -
sum(CASE WHEN balance < 0 THEN 1 ELSE 0 END) OVER(PARTITION BY account_no ORDER BY as_on_date)
end grp
FROM t
order by account_no, As_on_date;
ACCOUNT_NO
BALANCE
AS_ON_DATE
DAYS_PASSED
START_DATE
1001
-100
01-JAN-2013
1
01-JAN-2013
1001
-150
02-JAN-2013
2
01-JAN-2013
1001
200
03-JAN-2013
1001
-250
04-JAN-2013
1
04-JAN-2013
1001
-300
05-JAN-2013
2
04-JAN-2013
1001
-310
06-JAN-2013
3
04-JAN-2013 -
Query for getting data for every quarter for financial year
Hi,
My problem is I need to get the data for every quarter for financial year and also I need data for every week for financial year.
For example for financial year 2012-13, Apr2012 to Jun2012 would be Q1, Jul2012 to Sep2012 would be Q2 and so on. Total 8quarters should come upto Apr2013.
In the same way 1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
Thanks in advance.lakmesri wrote:
Hi,
My problem is I need to get the data for every quarter for financial year and also I need data for every week for financial year.
For example for financial year 2012-13, Apr2012 to Jun2012 would be Q1, Jul2012 to Sep2012 would be Q2 and so on. Total 8quarters should come upto Apr2013.
In the same way 1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
Thanks in advance.
How can you get 8 quarters within a year ? I'b be concerned here.
lakmesri wrote:
Hi,
In the same way 1st apr 2012 to 7th apr 2012 would be week1, 8th apr to 15th apr would be week2 and son on. How to write a query for this scenario in oracle. Can anybody help me on this. very urgent..
Thanks in advance.
First, that question is really not clearly asked. Second how could it be urgent ? You even did not tell us your Oracle version, did not show any tables descr, output sample nor any effort on your side to work on.
Nicolas. -
Oracle query to get all occurences of a text in a string
Hi
Does anybody know how to write a query to get all occurences of a text in a string in different rows of the table
For eg:
I have a string <aa>bb</aa><aa>cc</aa><aa>ddd</aa>
I have to find every occurence of <aa> and get the data between <aa> and </aa>
So the output should be
bb
cc
ddd
I think this can be done by using a regular expression but I dont know how.
Can anyone help me?
Thanks in advance.user2360027 wrote:
BluShadow,
The query gives correct results if i only have <aa></aa>
What if i have <ff></ff>?
Example:
<aa>bb</aa><aa>cc</aa><aa>ddd</aa><ff>dsd</ff>
I want to have the following (dsd should not be there in the result)
bb
cc
dddThis is a new requirement and not what you asked for in your original post. Perhaps you should tell us exactly what you are trying to achieve and what database version you are using to save us guessing.
To crokitta,
This version will deal with multiple rows..
SQL> ed
Wrote file afiedt.buf
1 with t as (select '<aa>bb</aa><aa>cc</aa><aa>ddd</aa>' as x from dual union all
2 select '<aa>xx</aa><aa>yy</aa>' from dual)
3 -- end of test data
4 select x, vals
5 from (
6 select x, regexp_replace(REGEXP_SUBSTR (x, '>[^<]+', 1, lvl),'[<>]') as vals
7 from t
8 ,(select level lvl from dual connect by level <= (select max(length(regexp_replace(x,'[^>]*'))/2) from t))
9 )
10 where vals is not null
11* order by 1,2
SQL> /
X VALS
<aa>bb</aa><aa>cc</aa><aa>ddd</aa> bb
<aa>bb</aa><aa>cc</aa><aa>ddd</aa> cc
<aa>bb</aa><aa>cc</aa><aa>ddd</aa> ddd
<aa>xx</aa><aa>yy</aa> xx
<aa>xx</aa><aa>yy</aa> yy
SQL> -
OIM sql Query for getting the status of the task which got failed
Hi Everyone,
We have a requirement like we need to get the status of a particular task(say Create User in OID resource - Completed\Rejected status) for the particular user.We are able to get the status of the resource provisioed to the user but not the status of the particular task getting trigerred for the user.can someone put some light on this.We need to get the SQL query for this.
Thanks in Advance.
Regards,
MKNHi
Use this sample query to get the task status, also check the cooments
SELECT USR.USR_LOGIN, OSI.SCH_KEY,SCH.SCH_STATUS,STA.STA_BUCKET FROM
OSI,SCH,STA,MIL,TOS,PKG,OIU,USR,OBJ,OST
WHERE OSI.MIL_KEY=MIL.MIL_KEY
AND SCH.SCH_KEY=OSI.SCH_KEY
AND STA.STA_STATUS=SCH.SCH_STATUS
AND TOS.PKG_KEY=PKG.PKG_KEY
AND MIL.TOS_KEY=TOS.TOS_KEY
AND OIU.USR_KEY=USR.USR_KEY
AND OIU.OST_KEY=OST.OST_KEY
AND OST.OBJ_KEY=OBJ.OBJ_KEY
AND OSI.ORC_KEY=OIU.ORC_KEY
AND OBJ.OBJ_NAME='AD User'
AND OST.OST_STATUS = 'Provisioning' -- filter accordinglly
AND STA.STA_BUCKET = 'Pending' -- filter accordinglly
AND PKG.PKG_NAME='AD User' -- filter accordinglly
AND MIL.MIL_NAME='System Validation' ---- filter accordinglly
Thanks,
Kuldeep -
Hi Everyone,
I want oracle query with which we can retrieve information about oracle RAC.
This information is, No of Clusters, Db instances...
Which Tables i can query for this information?
Thank You In Advance...
RoshanHi,
I think you would mean active instances on your cluster....
Query v$active_instances
04/05/[email protected]=287> select * from v$active_instances;
INST_NUMBER INST_NAME
1 rac1:ORCL1
2 rac2:ORCL2
2 rows selected.
Regards,
Rodrigo Mufalani
http://mufalani.blogspot.com -
ABAP User Roles and Query for accessing particular T- codes and Reports
dear Gurus
I have one problem, i want to know about ABAP User Query ,i have one requirement my user wants to Lock all the HR Std versus Customized reports in T- code SQ01,other department peoples also see the Payslips and Hr personal reports which is harmfull to the dept so i want to Lock all the reports in Std T- code in SQ01 and i have created one Customized User Roles or Query in which the T-codes and Reports are assigned only those particular user can access the T-codes and Std reports .how can it be possible i dont have any idea about user roles and Queries .
kindly help me out or send me some documents related to user roles and queries
regards ritesh sharmaHi Ritesh,
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/103cafc2-7a64-2b10-14b3-eddb7d324561
Regards,
Flavya -
Query for get username and profile and password life time
please provide query for this output
Profile Username Password Life Time
DEFAULT APPQOSSYS UNLIMITED days
DEFAULT CZ36QW UNLIMITED days
DEFAULT DBSPI UNLIMITED days
please tell me Password Life Time in this col um shows empty.please provide query for this output
Profile Username Password Life Time
DEFAULT APPQOSSYS UNLIMITED days
DEFAULT CZ36QW UNLIMITED days
DEFAULT DBSPI UNLIMITED days
please tell me Password Life Time in this col um shows empty. -
Need sql query to get sales channel code
Hi Experts,
As per my requirement i need to get the sales channel code by passing invoice number or transaction number ,or concurrent request id, with out any join condition . Please help me on this.
Regards
Deb1. Below query will give you status of all the request.
SELECT REQ.REQUEST_ID , REQ.REQUEST_STATUS FROM REQUEST REQ
2. You can have following status
Obtaining Operation Approval
Obtaining Template Approval
Operation Approval Approved
Operation Approval Rejected
Post Operation Processing Initiated
Request Approval Rejected
Request Closed
Request Completed
Request Created
Request Failed
Request Withdrawn
Template Approval Rejected
3. Now prepare the query from above sapmle, the requset status string should not contains foloowing values.
Rejected
Failed
Closed
Withdrawn
Completed
The builded query will give you the desired result for 11g
for 10 G
Get the OST_STATUS from Req table, and do you logic above stated
-Kuldeep
Edited by: Kuldeep on May 22, 2012 1:04 AM
Maybe you are looking for
-
Is there a card that can display DVDSP to an NTSC Monitor
I'm working on a Mac and would like to be able to view my Mpeg2 files and Menu on an NTSC external monitor. Is there a card on the market that can do this ??? Thanks
-
How is the LabVIEW 7.1 Student Edition delivered?
I recently requested LabVIEW 7.1 Student Edition for use with the NXT from http://digital.ni.com/express.nsf/bycode/lvtoolkitlego. A email was sent saying that labVIEW would be shipped. Does anyone know about how this works? Message Edited by RHPGu
-
Using Oracle10gR2 If i create a new tablespace or add datafile on the primary db will it automatically create on the STANDBY LOGICAL & PHYSICAL Please advice
-
Button links to different scenes
Hey all, This is so basic it's almost embarassing to post about, but I'm in a pinch and can't for the life of me figure out what's wrong... I'm using MX Professional 2004. My movie has four scenes; "Main" which plays on load, then three other scenes:
-
Virtual Machine could not be started because the hypervisor is not running
Hi I have installed Windows Server 2012 Standard Edition with a GUI. Default configuration, nothing special. Whenever I want to turn on any machine inside of Hyper-V, the following error message appears: "Virtual Machine could not be started because