Need of a logic of creation of SQL query
Hi Experts,Could you please help me get the follwing desired output. Thank you
Actual data:
ABC01-02
XYZ02-03
PQR78-79
LMN1-5
Expected/desired output:
ABC01
ABC02
XYZ02
XYZ03
PQR78
PQR79
LMN1
LMN5
Please let me know if you need additional information. Thanks in advance.
Concerning
Ralu
with data as (
select 'ABC01-02' s from dual union all
select 'XYZ02-03' from dual union all
select 'PQR78-79' from dual union all
select 'LMN1-5' from dual
)
select
regexp_substr(s,'[^[:digit:]]+')
||regexp_substr(s,'[[:digit:]]+',1,1)
s
from data
union all
select
regexp_substr(s,'[^[:digit:]]+')
||regexp_substr(s,'[[:digit:]]+',1,2)
from data
order by s
S
"ABC01"
"ABC02"
"LMN1"
"LMN5"
"PQR78"
"PQR79"
"XYZ02"
"XYZ03"
Tags: Database
Similar Questions
-
Need help for the Partition of PL/SQL query for a question
Hi all
I'm running on a question that I'm not able to get the desired result. I would appreciate if one of you experts can help resolve this.SQL * more: Production of release 11.2.0.1.0 game 4 Feb 09:31:26 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.Connected to:
Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
with t as)
Select 1 numero_enregistrement, Student_ID 123, nvl (trim (01), 'NULL') like Item_id, 'ITEM_ID_01' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_02' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_03' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_04' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_05' FIELD_NAME Union double all the
Select 1 numero_enregistrement, Student_ID 123, nvl (trim(' '), 'NULL') like Item_id, 'ITEM_ID_06' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('01'), 'NULL') like Item_id, 'ITEM_ID_01' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('02'), 'NULL') like Item_id, 'ITEM_ID_02' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('03'), 'NULL') like Item_id, 'ITEM_ID_03' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('01'), 'NULL') like Item_id, 'ITEM_ID_04' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('01'), 'NULL') like Item_id, 'ITEM_ID_05' FIELD_NAME Union double all the
Select 2 numero_enregistrement, Student_ID 123, nvl (trim('02'), 'NULL') like Item_id, 'ITEM_ID_06' double FIELD_NAME)
SELECT distinct COUNT (*) OVER (PARTITION BY numero_enregistrement ORDER BY numero_enregistrement) REC_COUNT, numero_enregistrement, STUDENT_ID, ITEM_ID, Field_Name FROM t
where ITEM_ID = 'NULL '.I get the following result.
NUMERO_ENREGISTREMENT ITEM_ID FIELD_NAME STUDENT_ID REC_COUNT
5 1 123 NULL ITEM_ID_02
5 1 123 NULL ITEM_ID_03
5 1 123 NULL ITEM_ID_04
5 1 123 NULL ITEM_ID_05
5 1 123 NULL ITEM_ID_06
My desired output isRec_COUNT Student_ID ITEM_ID FIELD_NAME numero_enregistrement
5 1 123 NULL ITEM_ID_02, ITEM_ID_03, ITEM_ID_04, ITEM_ID_04, ITEM_ID_05Thanks in advance
Rajesh
Hi, Renon,
Thanks for posting the sample data and results; It is very useful.
Be sure to explain exactly how you get these results from these data. There are many different reasons you may have, that all happen to produce the same results with the sample data you posted, but will get different results with other data sets.
This looks like a job for aggregate (including the LISTAGG) functions and GROUP BY, not for functions, analytical and PARTITION BY
-
need help with the place where small sql query
types of numbers names {}
ID | name | ID | Phone | which | type of | ID | type |
| 1. Jenny | 1. 867-5309 | 1. 3 | | 1. Home |
| 4: Tom | 4: 555-1212. 3. 1 | | 4: cell |
| 3. Smith | 3. 364-4311 | 3. 2 | | 3. work |
| 4. Amy | 4. 936-2828 | 4. 3 | | 4. Fax |
| 5. 525-8722 | 3. NULL | -----------
----------------------------
I'm currently out put like this:
Type name phone
| Smith | Home | 555-1212 |
| Smith | cell | 364-4311 |
| Smith | NULL | 525-8722 |
is it possible to get the time of the tree 'smith' in the name column, which confuses me a lot
{Please can someone give idea how to solve this problem}
Published by: user4463478 on May 20, 2009 17:38
Edited by: user4463478 May 21, 2009 11:51
Edited by: user4463478 May 21, 2009 11:52select n.name,t.type,s.phone from names n,numbers s,types t where n.id=s.who and s.type=t.id(+)---right outer join and name ='&name'
Here go us
-
OBIEE logical column has same SQL but returns different results
I have a SQL query with a case statement that returns the correct results by operating in Oracle SQL Developer. I've created several logical columns in OBIEE, one for each case in the original query. However, the results returned by each logical column OBIEE are radically different from the original SQL query results, even if the SQL code is virtually identical.
For example, a column logical OBIEE that returns incorrect results contains the following SQL code:
SUM (CASE when
("Registration - College". "" Effective colleges F. ("" Postal code "like '% a %') or
("Registration - College". "" Effective colleges F. ("" Postal code "like '%B %') or
("Registration - College". "" Effective colleges F. ("" Postal code "like '%c %') or
("Registration - College". "" Effective colleges F. ("" Postal code "like"% %") or
("Registration - College". "" Effective colleges F. ("" Postal code "like '%G %') or
("Registration - College". "" Effective colleges F. ("" Postal code "like"hour %") or
("Registration - College". "" Effective colleges F. ("" Postal code "like"%%J") or
("Registration - College". "" Effective colleges F. ("' Postal code ' like '%R %') or
("Registration - College". "" Effective colleges F. ("" Postal code "like '%s %') or
("Registration - College". "" Effective colleges F. ("" Postal code "like '%T %') or
("Registration - College". "" Effective colleges F. ("" Postal code "like"% %") or
("Registration - College". "" Effective colleges F. ("" Postal code "like '%x %') or
("Registration - College". "" Effective colleges F. ("' Postal code ' like '%Y %')
THEN 0 OTHERWISE 1 END)
The case statement in the original SQL query, which returns the correct results, is as follows:
CASE
WHEN (postal_zip_code_permanent like "%%K") or (postal_zip_code_permanent like '% %') or (postal_zip_code_permanent like '%m %') or (postal_zip_code_permanent like '%n %') or (postal_zip_code_permanent like "%p %") THEN "Ontario".
WHEN (postal_zip_code_permanent like '% a %') or (postal_zip_code_permanent like '%B %') or (postal_zip_code_permanent like '%c %') or (postal_zip_code_permanent like '% %') or (postal_zip_code_permanent like '%G %') or (postal_zip_code_permanent like "%hour") or (postal_zip_code_permanent like "%%J") or (postal_zip_code_permanent like "%%R") or (postal_zip_code_permanent like '%s %') or (postal_zip_code_permanent like '%t %') or (postal_zip_code_permanent like '% %') or (postal_zip_ code_permanent like '%x %') or (postal_zip_code_permanent like "%%Y") THEN "Canada, other than Ontario.
WHEN (substr(postal_zip_code_permanent,1,1) IN ('1 ', '2', '3', '4', '5', '6' ', 7',' 8 ', ' 9',' 0') or (postal_zip_code_permanent like '%d %') or (postal_zip_code_permanent like '%f %') or (postal_zip_code_permanent like ' % I %') or (postal_zip_code_permanent like "% O") or (postal_zip_code_permanent like "%%Q") or (postal_zip_code_permanent like "%%U") or (postal_zip_code_permanent like ' % W ') or (postal_zip_code_permanent like "%%Z")) THEN 'other')
WHEN (postal_zip_code_permanent like '% + %') or (postal_zip_code_permanent like '%. %') or (postal_zip_code_permanent like ' %? %') or (postal_zip_code_permanent like '% %') or postal_zip_code_permanent IN ('+ ','.', '?)) (',',') And THEN "Invalid."
WHEN postal_zip_code_permanent is null THEN 'Blank '.
Of OTHER postal_zip_code_permanent
END
Now I see what the problem was. In the original SQL query, each condition is exclusive, for each record will only be categorized in one of the scenarios WHEN. But in OBIEE, each logical column is autonomous, so some records were classified into more than logical column, even if each logical column was supposed to be exclusive.
-
Hello
I have a data in table (raj_table) with columns (char11) raj_id, raj_number (varchar2 (15)), raj_format (NUMBER), Primary_ID (identity with the values of the primary key column)
Primary_ID raj_id Raj_number Raj_format
1 raj rajvend 1
2 raj rajvend 1
3 raj rajvendor1 2
4 raj rajvendor1 2
5 raj rajvendor1 2
6 raj rajvendor2 3
I used under SQL to get query output as below, but has not achieved the required result:
Select client_id vendor_number, vendor_format, primary_id, row_number() on sl_no (client_id partition, primary_id, vendor_format order of client_id primary_id, vendor_format, vendor_number, vendor_number)
from raj_table by sl_no asc
SL_NO raj_id raj_number raj_format primary_id
1 1 raj rajvendor 1
1 2 raj rajvendor 1
2 3 raj rajvendor1 2
2 4 raj rajvendor1 2
2 5 raj rajvendor1 2
3 6 raj rajvendor2 3
I need help with a SQL query to get the result as above without using the group by clause. I want to bring together the combination of separate line of the three columns (raj_id, raj_number, raj_format) and add a unique serial number for each online game (SL_NO column below). So, above there are 3 unique set of (raj_id, raj_number, raj_format) I can get in a group by clause, but I can not add prmiary_id, SL_NO values if I group by clause. I used the analytical functions like row_number() but no luck. Need solution for this.
with t as)
Select 'raj' raj_id, 'rajvend' raj_number, 1 raj_format, 1 primary_id Union double all the
Select option 2, 'raj', 'rajvend', 1 double Union all
Select 3, 'raj', 'rajvendor1', 2 double Union all
Select 4, 'raj', 'rajvendor1', 2 double Union all
Select 5, 'raj', 'rajvendor1', 2 double Union all
Select 6, 'raj', 'rajvendor2', 3 double
)
Select dense_rank() over (order of raj_id, raj_number, raj_format) sl_no,
t.*
t
order by primary_id
/
PRIMARY_ID RAJ RAJ_NUMBER RAJ_FORMAT SL_NO
---------- ---------- --- ---------- ----------
1 1 raj rajvend 1
1 2 raj rajvend 1
2 3 raj rajvendor1 2
2 4 raj rajvendor1 2
2 5 raj rajvendor1 2
3 6 raj rajvendor2 36 selected lines.
SQL >
SY.
-
issue in the creation of the IOM group reactivate via sql query.
Hi guys,.
I am trying to create a group to IOM database through sql query:
insert into ugp(ugp_key,ugp_name,ugp_create,ugp_update,ugp_createby,ugp_updateby,) values(786,'dbrole','09-jul-12','09-jul-12',1,1);
It is the inclusion of the group in the table of the PMU, but he does not appear in the administration console.
After that, I also tried with this query:
insert into gpp(ugp_key,gpp_ugp_key,gpp_write,gpp_delete,gpp_create,gpp_createby,gpp_update,gpp_updateby) values (786,1,1,1,'09-jul-12',1,'09-jul-12',1);
After I haven't tried with this query.but still no use.
and I also tried to assign a user to the group through query:
insert into usg(ugp_key,usr_key,usg_priority,usg_create,usg_update,usg_createby,usg_updateby) values (4,81,1,'09-jul-12','09-jul-12',1,1);
But always the same problem.it is the insertion in db.but do not enter in the administration console.
Thank you
Hanuman.Muriel Hanuman says:
Thanks guys.the above queries are successfully.just to work I rebooted the server.I certify here if we want to add the group to 10g through sql query, then insert the records in the tables 'PMU' and 'MPP '.
11 g, need to add records from the ugp only table. Because the administrator has also not found in this table only.so no need to table gpp.
Thank you
Hanuman.T1 groups are stored in the table of the PMU to IOM 11.1.1.5. The table of the GPP is present, but not used in 11.1.1.3 and is totally deleted schema repo in 11.1.1.5
2. as far as I know, there is no other vital records except that in UGP table objects are created for a group, you are, in theory, able to create groups with direct SQL. Using the API of the IOM is the preferred method.
3. you must use the sequence UGP_SEQ to get a new key for a group that you create.Vladimir
-
Hi all
Sorry I can't speak English very well
=======================
I have a table that contains two columns
table name: total_sal
column name: hire_date
column name: salary
table syntax
create table total_sal (hire_date date
number (6.2)) of salary;
_________________________________________
Example of data in table format
hire_date | salary
01/01/2011 | 1000
01/02/2011 | 2000
01/05/2011 | 500
01/09/2011 | 400
I NEED a SQL QUERY to display the table, as in this example
OF | TO|||||||||||| TOTALSALAY
01/01/2011 | 01/02/2011 | 3000
07/05/2011 | 01/09/2011 | 900
|||||||||||||||||||||||||||||||||| 3900/* Formatted on 9/23/2011 10:14:40 AM (QP5 v5.149.1003.31008) */ WITH t AS (SELECT TO_DATE ('1/1/2011', 'mm/dd/yyyy') hire_date, 1000 salary FROM DUAL UNION SELECT TO_DATE ('2/1/2011', 'mm/dd/yyyy'), 2000 FROM DUAL UNION SELECT TO_DATE ('5/1/2011', 'mm/dd/yyyy'), 500 FROM DUAL UNION SELECT TO_DATE ('9/1/2011', 'mm/dd/yyyy'), 400 FROM DUAL) SELECT "From", "To", totalsalary FROM (SELECT hire_date "From", LEAD (hire_date) OVER (ORDER BY hire_date) "To", salary + LEAD (salary) OVER (ORDER BY hire_date) totalsalary, ROW_NUMBER () OVER (ORDER BY hire_date) rn FROM t) WHERE MOD (rn, 2) = 1 UNION ALL SELECT NULL, NULL, SUM (salary) FROM t
From To TOTALSALARY 1/1/2011 2/1/2011 3000 5/1/2011 9/1/2011 900 3900
-
Need to SQL query to filter records by limited rows and certain condition
Hello guru (s).
I need a SQL query for help.
For an example table t1 as below, I want to find the maximum of 5 larger, but there should be no more than 2 name of the same position. The "BOLD" is the response of desire.
Name Position size
N1 P1 5
N2 P2 50
N3 P3 500
N4 P1 6
N5 P2 60
N6 P3 600
N7 P1 7
N8 P2 70
N9 P3 700
Thank you.not tested!
select name,position,size, from (select name,position,size, row_number() over (order by size desc) a_count from (select name,position,size, row_number() over (partition by position order by size desc) a_count from your_table ) where a_count <= 2 ) where a_count <= 5
Concerning
Etbin
-
need help with sql query dates
Hello
I have a sql query I need to extract some info between data dates. Where clause in this query is:
WHERE CPD_BUS_UNIT =: ESI_PRM_1
AND CPD_VOUCHER_DATE > =: P_DATE_FROM
AND CPD_VOUCHER_DATE < (: P_DATE_TO + 1).
When I run the query into a toad, I can view the data, but not the execution plan. It gives an error ORA-00932 inconsistent Datatypes.
But when I remove (+ 1): P_DATE_TO, I can c the execution plan and data. The data will be different from the previous.
Please suggest how to rewrite the query.Can you please give it a try?
WHERE CPD_BUS_UNIT=:ESI_PRM_1 AND CPD_VOUCHER_DATE >= :to_date(P_DATE_FROM) AND CPD_VOUCHER_DATE < (to_date(:P_DATE_TO)+1)
Concerning
-
Need help with PL/SQL query complex
I need help with a query that need access to data from 3 tables. That's what I did
I created 3 tables
CREATE TABLE post_table
(
post_id varchar (20),
datepost DATE,
KEY (post_id) elementary SCHOOL
) ;
CREATE TABLE topic
(
TOPIC_ID varchar (20),
name varchar (20),
PRIMARY KEY (topic_id)
);
CREATE TABLE blogpost_table
(
TOPIC_ID varchar (20),
post_id varchar (20),
PRIMARY KEY (topic_id, post_id);
FOREIGN KEY (topic_id) REFERENCES topic (topic_id) ON DELETE CASCADE,
FOREIGN KEY (post_id) REFERENCES post_table (post_id) ON DELETE CASCADE
);
Now, I inserted a few values in these tables as
INSERT INTO post_table VALUES ('p1', to_date ('2009-09-14 18:00 "," MM/DD/YYYY mi:ss'));))
INSERT INTO post_table VALUES ('p2', to_date ('2009-07-18 18:00 "," MM/DD/YYYY mi:ss'));))
INSERT INTO post_table VALUES ('p3', to_date ('2009-07-11 18:00 "," MM/DD/YYYY mi:ss'));))
INSERT INTO post_table VALUES ('p4', to_date ('2009-03-11 18:00 "," MM/DD/YYYY mi:ss'));))
INSERT INTO post_table VALUES ('p5', to_date ('2009-07-13 18:00 "," MM/DD/YYYY mi:ss'));))
INSERT INTO post_table VALUES ('p6', to_date ('2009-06-12 18:00 "," MM/DD/YYYY mi:ss'));))
INSERT INTO post_table VALUES ('p7', to_date ('2009-07-11 18:00 "," MM/DD/YYYY mi:ss'));))
INSERT INTO VALUES subject ("t1", "baseball");
INSERT INTO category VALUES ('t2', 'football');
INSERT INTO blogpost_table VALUES ("t1", "p1");
INSERT INTO blogpost_table VALUES ('t1', 'p3');
INSERT INTO blogpost_table VALUES ("t1", "p4");
INSERT INTO blogpost_table VALUES ('t1', 'p5');
INSERT INTO blogpost_table VALUES ('t2', 'p2');
INSERT INTO blogpost_table VALUES ('t2', 'p6');
INSERT INTO blogpost_table VALUES ("t2", "p7");
I'm launching SQL queries on the table in this topic.
I want to write a SQL query that returns me the name of a topic (s) and the number of blog_post (s) associated with the topic in descending order of the number of blog posts created in July.
Can someone please help me to write this query?
Thank you
Published by: user11994430 on October 9, 2009 07:24Thanks for the test of the configuration!
SQL>SELECT t.NAME, COUNT(*) 2 FROM topic t, blogpost_table b, post_table p 3 WHERE b.topic_id = t.topic_id 4 AND p.post_id = b.post_id 5 AND p.datepost >= DATE '2009-07-01' 6 AND p.datepost < DATE '2009-08-01' 7 GROUP BY t.NAME 8 ORDER BY COUNT(*) desc; NAME COUNT(*) -------------------- ---------- baseball 2 soccer 2
HTH, Urs
-
need to customize SQL query verification
Friends,
I need to create a custom sql query. Please see the following scenarios:
I want to audit all users who are successfully and unsuccessfully to logon to my oracle database. Tahts why I enbale 2 following options:
SQL > session audit every time that successful;
Verification succeeded.
SQL > noaudit session each time it fails.
Verification succeeded.
And I found all the users using the following sql query:
"Select username, to_char (timestamp," MM/DD/YY HH24 ' ") Timestamp, obj_name, returncode, action_name of."
"dba_audit_trail where action_name in ('LOGIN', 'LOGOUT') order by timestamp desc '.
USERNAME TIMESTAMP OBJ_NAME RETURN_CODE ACTION_NAME
-------- --------- -------- ------------- -----------
RIPON 14-12-08 11:51 0 LOGON
SHIPON 14-12-08 11:50 1017 LOGON
RIPON 14-12-08 11:50 1017 LOGON
Here, return_code = 1017 means the user cannot successfully loged on
and, return_code = 0 the average user can successfully connected
Now, I want to custom to the query that is readable to others easily. As
I want to add a column, which meets the follwing If condition.
Return_code = 0, then the column is 'USER CORRECTLY CONNECTED ON' and
If return_code = 1017, then the column displays "USER NOT CORRECTLY CONNECTED ON".
can someone please help with this?
Edited by: shipon_97 14 December 2008 13:28A CASE statement is probably the easiest option
select username, to_char(timestamp,'MM/DD/YY HH24:MI') Timestamp, obj_name, returncode, action_name, (CASE WHEN return_code = 0 THEN 'User logged in successfully' WHEN return_code = 1017 THEN 'User specified an invalid password' ELSE 'User failed to log in for some other reason' END) reason_desc from dba_audit_trail where action_name in ('LOGON','LOGOFF') order by timestamp desc
Note that any nonzero return code indicates a failed to connect. ORA-01017 indicates an invalid user name or password, which is probably the most common error.
Justin
-
Hi all
Here is the sql query,
Select papf.employee_number,
-papf.full_name, ppa.effective_date, pp.payroll_name,
PET.element_name,
PIV. Name input_value,
prrv.result_value
-, ppa.payroll_action_id, ppa.time_period_id
Of
Apps.pay_payroll_actions App,
pay_assignment_actions AAP,
pay_payrolls_f pp,
pay_run_results prr,
prrv pay_run_result_values,
pay_input_values_f piv,
animal pay_element_types_f,
Apps.per_all_assignments_f ADP,
Apps.per_all_people_f women's wear
-where ppa.payroll_action_id =: payroll_action_id - give your payroll_action_id
where ppa.payroll_id =: payroll_id
and ppa.payroll_action_id =: payroll_action_id
- and paa.assignment_action_id =: assignment_action_id
and ppa.payroll_action_id = paa.payroll_action_id
and ppa.payroll_id = pp.payroll_id
and paa.assignment_action_id = prr.assignment_action_id
and prr.run_result_id = prrv.run_result_id
and prrv.input_value_id = piv.input_value_id
and piv.element_type_id = pet.element_type_id
and paaf.assignment_id = paa.assignment_id
and paaf.person_id = papf.person_id
and trunc (sysdate) between pp.effective_start_date and pp.effective_end_date
and trunc (sysdate) between pet.effective_start_date and pet.effective_end_date
and trunc (sysdate) between piv.effective_start_date and piv.effective_end_date
and trunc (sysdate) between paaf.effective_start_date and paaf.effective_end_date
and trunc (sysdate) between papf.effective_start_date and papf.effective_end_date
- and papf.employee_number = '1'
- and ppa.effective_date = July 22, 2014"
and pet.element_name in ('Local Mission allowance', "Compensation of Mission International")
order by 1.3
The result is:
Employee_number Element_Name Input_Value Result_value
1 compensation of Mission international day amount 1000
1 compensation of international Mission Distance days 4
1 value to pay compensation of 1200 International Mission
1 International Mission allowance Start Date 01/01/2014
1 compensation of Mission international day amount 800
1 compensation of international Mission Distance days 10
1 International Mission allowance pay value 2000
1 International Mission allowance Start Date 01/02/2014
1 compensation of Mission local day amount 500
1 compensation of local Mission Distance days 10
1 Mission allowance paid local value 1000
1 compensation of local Mission Start Date 01/11/2014
Desired output:
Employee_number Element_Name Day_Amount Distance_Days Pay_Value Start_Date
1 compensation of international Mission 1000, 1200 4 2014/01/01
1
International Mission allowance 800 10 2000 01/02/2014 1 Mission local compensation 500 10 1000 01/11/2014 Please suggest.
INSERT statement:
TOGETHER TO DEFINE
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Day amount', '1000');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Day amount', '1000');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'number of orders', '196');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'number of orders', '195');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Distance days, 4 ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Distance days, 1 ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
("1', 'International Mission allowance', 'employee Category", "scale of employment medical cities");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
("1', 'International Mission allowance', 'employee Category", "scale of employment medical cities");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Class level', 'G3');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Class level', 'G3');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'class of employment, ' ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'class of employment, ' ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Country of Mission', ' 3003 - Kuwait ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Country of Mission', ' 2004 - Canada ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Mission days, 4' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Mission days, 3' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international","End of Mission Date"' 2014/07/10 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international","End of Mission Date"' 2014/07/19 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international", 'Mission Start Date', ' 2014/07/07 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international", 'Mission Start Date', ' 2014/07/17 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'value of pay', '3000');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'value of pay', '4000');
00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'number of orders', '45');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'number of orders', "456789");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' away days '0' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' Distance days, 1 ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', 'Provided food', 'Y');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'compensation of local Mission","Accommodation provided", 'Y');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'compensation of local Mission","Accommodation provided", 'Y');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', "local Mission allowance", "Mission City", "AL MEDINA");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', "local Mission allowance", "Mission City", "RIYADH");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' Mission days, 4' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' Mission days, 5' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'End of Mission Date' ' 2014/06/16 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'End of Mission Date' ' 2014-06-14 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'Mission Start Date', ' 2014/06/13 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'Mission Start Date', ' 2014/06/10 00:00:00 ');
Thank you very much in advance.
Kind regards
Afzal.
So then... something like this:
SELECT employee_number
element_name
MAX (decode (input_value, 'Day amount', result_value)) AS day_amount
MAX (decode (input_value, 'Days of Distance', result_value)) AS Distance_Days
, MAX (decode (input_value, 'Value of pay', result_value)) AS Pay_Value
MAX (decode (input_value, 'Start Date', result_value)) AS Start_Date
from (SELECT papf.employee_number
pet.element_name
piv.NAME input_value
prrv.result_value
prrv.run_result_id
OF apps.pay_payroll_actions App
pay_assignment_actions PAA
pay_payrolls_f pp
pay_run_results prr
pay_run_result_values prrv
pay_input_values_f piv
pay_element_types_f pet
apps.per_all_assignments_f ADP
apps.per_all_people_f women's wear
-where ppa.payroll_action_id =: payroll_action_id - give your payroll_action_id
WHERE ppa.payroll_id =: payroll_id
AND ppa.payroll_action_id =: payroll_action_id
- and paa.assignment_action_id =: assignment_action_id
AND ppa.payroll_action_id = paa.payroll_action_id
AND ppa.payroll_id = pp.payroll_id
AND paa.assignment_action_id = prr.assignment_action_id
AND prr.run_result_id = prrv.run_result_id
AND prrv.input_value_id = piv.input_value_id
AND piv.element_type_id = pet.element_type_id
AND paaf.assignment_id = paa.assignment_id
AND paaf.person_id = papf.person_id
AND trunc (sysdate) BETWEEN pp.effective_start_date AND pp.effective_end_date
AND trunc (sysdate) BETWEEN pet.effective_start_date AND pet.effective_end_date
AND trunc (sysdate) BETWEEN piv.effective_start_date AND piv.effective_end_date
AND trunc (sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND trunc (sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND pet.element_name IN ('local Mission allowance', 'International Mission'))
GROUP BY employee_number
element_name
run_result_id
;
You should get your desired result.
Roger
-
Need for SQL query to get the result.
Region
Month Trx type Summary of the resolution AMERICAS -13 may Adjustments Fix EMEA -13 may Adjustments Incorrect AMERICAS -13 may Credit memo Incorrect EMEA -13 may Invoice Fix AMERICAS -13 may Credit memo Fix OFD -13 may Adjustments Fix AMERICAS -13 may Invoice Incorrect DVL -13 may Adjustments Fix DVL -13 may Adjustments Fix OFD -13 may Adjustments Fix Above my Table and here is the result required. Similarly for other regions as well. Can someone help me with the SQL query?
Region Summary of the resolution Setting Credit memo Invoice Total general AMERICAS Fix 1 1 2 Incorrect 0 1 1 2 Like this?
SQL > select * from transaction_audit;
MTH TRX_TYPE REGION BOARD
-------- ------ ----------- ---------
AMERICAS-13 may SETTINGS CORRECT
EMEA-13 may INCORRECT ADJUSTMENT
AMERICAS-13 may CREDIT MEMO INCORRECT
EMEA-13 may INVOICE CORRECT
AMERICAS-13 may CREDIT MEMO CORRECT
OFD-13 may SETTINGS CORRECT
AMERICAS-13 may INVOICE INCORRECTE
LAD-13 may SETTINGS CORRECT
LAD-13 may SETTINGS CORRECT
OFD-13 may SETTINGS CORRECT10 selected lines.
SQL > select region
2, resolution_summary
3, count (decode (trx_type, "ADJUSTMENTS", trx_type)) adjustments
4, County (decode (trx_type, 'HAVING', trx_type)) credit_memo
5, County (decode (trx_type, "BILL", trx_type)) Bill
transaction_audit 6
Group 7
8 by region
9, resolution_summary
10 Decree
11 by region
12, resolution_summary
13.REGION TAKE ADJUSTMENTS CREDIT_MEMO INVOICE
-------- --------- ----------- ----------- ----------
CORRECT THE AMERICAS 1 1 0
0 1 1 INCORRECT AMERICAS
EMEA CORRECT 0 0 1
INCORRECT EMEA 1 0 0
DAL ADDRESS 2 0 0
OFD CORRECT 2 0 06 selected lines.
SQL >
-
Report model 101 - bubbles of commentary (used during the creation of SQL report)
Hello
There is a type of report - comment bubbles [Theme - 24, 25, 26]
Has anyone tried creating SQL report using this model.
OR if anyone knows how to use it and what should be the syntax of SQL query for the use of this model.
Thank you
DeepakHi Deepak.
I guess you run APEX 4.2
There is a packaged application included with 4.2 that is called 'Customer Tracker'
Page 50, you will find a rewgion where these how bubles are used (unlock the app to view the source).Concerning
Bottom -
Need help to write a SQL query complex
I have the source tabe as below
-> SOURCE_TABLE
I want to load as target table belowNAME CUST_ID SVC_ST_DT SVC_END_DT TOM 1 31/08/2009 23/03/2011 DOCK 2 01/01/2004 31/05/2010 HARRY 3 28/02/2007 31/12/2009
-> TARGET_TABLE
Is it possible to write a SQL query that returns the data in the same way above the target table.NAME CUST_ID SVC_ST_DT SVC_END_DT TOM 1 31/08/2009 31/12/2009 TOM 1 01/01/2010 31/12/2010 TOM 1 01/01/2011 23/03/2011 DOCK 2 01/01/2004 31/12/2004 DOCK 2 01/01/2005 31/12/2005 DOCK 2 01/01/2006 31/12/2006 DOCK 2 01/01/2007 31/12/2007 DOCK 2 01/01/2008 31/12/2008 DOCK 2 01/01/2009 31/12/2009 DOCK 2 01/01/2010 31/05/2010 HARRY 3 28/02/2007 31/12/2007 HARRY 3 01/01/2008 31/12/2008 HARRY 3 01/01/2009 31/12/2009
Published by: AChatterjee on April 30, 2012 07:14
Published by: AChatterjee on April 30, 2012 07:14Or like this...
SQL> ed Wrote file afiedt.buf 1 with t as (select 'TOM' as NAME, 1 as CUST_ID, date '2009-08-31' as SVC_ST_DT, date '2011-03-23' as SVC_END_DT from dual union all 2 select 'DOCK', 2, date '2004-01-01', date '2010-05-31' from dual union all 3 select 'HARRY', 3, date '2007-02-28', date '2009-12-31' from dual) 4 -- 5 -- end of test data 6 -- 7 select name, cust_id, svc_st_dt, svc_end_dt 8 from ( 9 select name 10 ,cust_id 11 ,greatest(svc_st_dt, add_months(trunc(svc_st_dt,'YYYY'),yr*12)) as svc_st_dt 12 ,least(svc_end_dt, add_months(trunc(svc_st_dt,'YYYY'),(yr+1)*12)-1) as svc_end_dt 13 from t 14 cross join (select rownum-1 as yr 15 from dual 16 connect by rownum <= (select extract(year from max(svc_end_dt)) - extract(year from min(svc_st_dt)) + 1 from t) 17 ) 18 ) 19 where svc_st_dt <= svc_end_dt 20* order by 2, 3 SQL> / NAME CUST_ID SVC_ST_DT SVC_END_DT ----- ---------- -------------------- -------------------- TOM 1 31-AUG-2009 00:00:00 31-DEC-2009 00:00:00 TOM 1 01-JAN-2010 00:00:00 31-DEC-2010 00:00:00 TOM 1 01-JAN-2011 00:00:00 23-MAR-2011 00:00:00 DOCK 2 01-JAN-2004 00:00:00 31-DEC-2004 00:00:00 DOCK 2 01-JAN-2005 00:00:00 31-DEC-2005 00:00:00 DOCK 2 01-JAN-2006 00:00:00 31-DEC-2006 00:00:00 DOCK 2 01-JAN-2007 00:00:00 31-DEC-2007 00:00:00 DOCK 2 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00 DOCK 2 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00 DOCK 2 01-JAN-2010 00:00:00 31-MAY-2010 00:00:00 HARRY 3 28-FEB-2007 00:00:00 31-DEC-2007 00:00:00 HARRY 3 01-JAN-2008 00:00:00 31-DEC-2008 00:00:00 HARRY 3 01-JAN-2009 00:00:00 31-DEC-2009 00:00:00 13 rows selected.
Maybe you are looking for
-
Mail stuck in Outbox in Windows Mail for XP
I have an email stuck in Outbox in Windows Mail. I found several posts for a similar problem with Vista and Outlook, but none of these solutions works for XP and WIndows Mail. Whenever I open the Outbox, the e-mail program crashes. I can't delete the
-
XP administrator cannot install new programs
When I try to install a program I get an error "You must be logged in as an administrator to install this program." I am the only user of XP Home and am registered as an administrator of the computer. I used system restore to go back to a time when t
-
Icons of blackBerry Smartphones on the question of the homepage - OS 6
Hi all Is there a way to lock the icons on the home screen, so it just display "All"? Sometimes I will move from left to right by accident and it show you things for download etc which is annoying when I have to keep switching it back on all. Thank
-
Twice on the same computer using Windows 7 upgrade
My computer with Windows 7 Ultimate upgrade crashed, and I need to reformat my system to my original Vista OS. I'll be able to use my Windows 7 upgrade disk a second time on the same computer? Will I need a new product key?
-
ThinkPad z60m hard drive upgrade
Hi all I have a thinkpad z60m I bought for a price very low. When I bought the laptop, it has been configured with processor 1.73GHz PM, 256 MB RAM and 40 GB HDD. I've already updated the memory to 2 GB to speed it up and it works well but I am now r