Problems with Sub query
Hello, I'm looking to create a sub query to display certain information. On the form that the information is entered, the user has the option to enter a phone number extension, as appropriate. If this is the case, I want the phone number to show as 555-867-5309 (x 1234). However, without the problem of controls, the (x) will be displayed without worrying and seems sloppy. Here is the code I have, please notify.There will be two places, it will be necessary - for the telephone number of the applicant and the app (SME) contact information manager.
Thank you.
select
pm.pk_proj_master_id "Project Number",
pm.trackit_work_order "TrackIt Work Order",
pm.name "Project Name",
pm.status "Project Status",
req.last_name||', '||req.first_name||', '||req.middle_initial||'.' "Requestor Name",
rde.department_group_descr "Requestor Department Name",
req.department_descr "Requestor Division Name",
pm.requester_ext,
case
when pm.requester_ext in
(
select
pm.requester_phone|| '(x'||pm.requester_ext ||')' "Requesters Number"
from
protrac_master pm
where
pm.requester_ext is not null
)
else
(
select
pm.requester_phone "Requesters Number"
from
protrac_master pm
)
end as "Requester Number",
man.last_name||', '||man.first_name||', '||man.middle_initial||'.' "SME Name",
mdg.department_group_descr "SME Department Name",
man.department_descr "SME Division Name",
pm.app_manager_ext,
case
when pm.app_manager_ext in
(
select
pm.app_manager_phone|| '(x'||pm.app_manager_ext ||')' "SME Number"
from
protrac_master pm
where
pm.app_manager_phone is not null
)
else
(
select
pm.app_manager_phone "SME Number"
from
protrac_master pm
)
end as "Requester Number",
pm.createby_date "Date Entered",
pm.date_begin "Date Began",
pm.date_completed "Date Completed",
pm.estimated_date "Estimated Completion Date"
from
protrac_master pm,
cobr.vw_pps_payroll req, cobr.department_group rde,
cobr.vw_pps_payroll man, cobr.department_group mdg
where
pm.requester_id = req.emple_no and
pm.requester_dept_id = rde.pk_department_group_id and
pm.app_manager_id = man.emple_no and
pm.app_manager_dept_id = mdg.pk_department_group_id
order by
pm.pk_proj_master_id
I think you can avoid the sub query thing simply by using the NVL2 function:
select ...
, NVL2( pm.requester_ext
, pm.requester_phone|| '(x'||pm.requester_ext ||')'
, pm.requester_phone) "Requesters Number"
...
, NVL2( pm.app_manager_ext
, pm.app_manager_phone|| '(x'||pm.app_manager_ext ||')'
, pm.app_manager_phone) "Manager Number"
...
from protrac_master pm
, ...
Tags: Database
Similar Questions
-
Problem with hierarchical query in function PL\SQL
I have a simple table containing the ID of the parent
-Create table
create the table1 table:
(
ID NUMBER (12) not null,
year number 4.
month NUMBER (2),
parent_id NUMBER (12)
);
-Create/recreate primary, unique and foreign key constraints
change the table1 table:
Add primary key constraint PK_TABLE1 (ID);
change the table1 table:
Add the foreign key constraint FK_TABLE1_PARENT (PARENT_ID)
reference TABLE1 (ID);
data:
Insert into TABLE1 (id, year, month, parent_id)
values (5, 2015, 12, 3);
Insert into TABLE1 (id, year, month, parent_id)
values (6 (2015), 12, 4);
Insert into TABLE1 (id, year, month, parent_id)
values (3 (2015), 11, 1);
Insert into TABLE1 (id, year, month, parent_id)
values (4 (2015), 11, 2);
Insert into TABLE1 (id, year, month, parent_id)
values (1, 2015, 10, null);
Insert into TABLE1 (id, year, month, parent_id)
values (2 (2015), 10, null);
commit;
and query
with h as
(select t.id, t.year, t.month, CONNECT_BY_ROOT t.id as parent_id from table1 t
where t.year = 2015 and t.month = 12
and CONNECT_BY_ROOT t.year = 2015 and CONNECT_BY_ROOT t.month = 10
connect by prior t.id = t.parent_id)
Select * from:
Join table1 t left t.id = h.parent_id;
It works, but when I put this request in the procedure pl\sql
create or replace procedure is get_report (p_cur_out on sys_refcursor)
Start
Open the p_cur_out for
with h as
(select t.id, t.year, t.month, CONNECT_BY_ROOT t.id as parent_id from table1 t
where t.year = 2015 and t.month = 12
and CONNECT_BY_ROOT t.year = 2015 and CONNECT_BY_ROOT t.month = 10
connect by prior t.id = t.parent_id)
Select * from:
Join table1 t left t.id = h.parent_id;
end get_report;
/
They do not compile. And in the fall, with the exception
Errors of compilation for the PC of the PROCEDURE. GET_REPORT
[Error: PL/SQL: ORA-00600: internal error code, arguments: [qctcte1], [0], [], [], [], [], [], [], [], [], []]
Online: 6
Text: with h as
Error: PL/SQL: statement ignored
Online: 6
Text: with h as
My version of oracle
1 Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production 2 PL/SQL Release 11.2.0.3.0 - Production 3 CORE Production 11.2.0.3.0 4 AMT for Linux: Version 11.2.0.3.0 - Production 5 NLSRTL Version 11.2.0.3.0 - Production What is the problem with my request? Or database? How to solve this problem?
If you have access to MOS, you can search the reason of it. If you are using left join syntax instead of joining ANSI, owner Oracle procedure compiles and returns the result.
-
What is the problem with this query?
Hello
I need some advice on how to change the following query (with perhaps some analytical function) to speed it up. Currently, it takes 6 + minutes. This query is executed in response to a request from the front-end application and 6 + min is certainly unacceptable.
I am trying to provide as much information I can think, but if more information is needed, please let me know.
I have a table called "wave_result". It contains millions of rows. PK is Wave_Id, Version_nbr, node_nbr and prod_nbr. For each 'wave_id + node_NBR + prod_nbr' there are several versions (version_nbr). In the following query, I try to extract a line with MAX version_nbr for combination of ' wave_id + node_NBR + prod_nbr.
H3. Request:
H3. Rank of charges:SELECT ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat, NVL (SUM (ip1.lsu), 0) val FROM ideal_prod ip1, ideal_store s, wave_result wr WHERE wr.wave_id = 51 AND wr.prod_nbr = ip1.prod_nbr AND wr.wave_id = ip1.wave_id AND wr.version_nbr = (SELECT MAX (wr1.version_nbr) FROM wave_result wr1 WHERE wr1.wave_id = wr.wave_id AND wr1.node_nbr = wr.node_nbr AND wr1.prod_nbr = wr.prod_nbr) AND NVL (wr.ovrd_dcsn_nm, wr.dcsn_nm) = 'Add' AND s.wave_id = wr.wave_id AND s.node_nbr = wr.node_nbr GROUP BY ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat
========
"wave_result" is the largest table with millions of rows.
H3. StatsTable Total Rows Rows for wave_id = 51 Ideal_prod 188K 38K Ideal_store 3K 574 Wave_result 90M 19M
are updated almost daily by the DBA (not sure if that's a good or bad).
H3. Explain the Plan:
=========
H3. Sample data:SELECT STATEMENT ALL_ROWS Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 12 HASH GROUP BY Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 11 VIEW VIEW SYS.VM_NWVW_2 Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 10 FILTER 9 HASH GROUP BY Cost: 330,737 Bytes: 2,425,603 Cardinality: 14,881 8 HASH JOIN Cost: 327,183 Bytes: 41,233,784 Cardinality: 252,968 1 INDEX RANGE SCAN INDEX (UNIQUE) APAPOPR.XPKIDEAL_STORE Cost: 4 Bytes: 13,202 Cardinality: 574 7 HASH JOIN Cost: 327,178 Bytes: 35,415,520 Cardinality: 252,968 5 HASH JOIN Cost: 198,619 Bytes: 18,764,328 Cardinality: 183,964 3 TABLE ACCESS BY INDEX ROWID TABLE APAPOPR.IDEAL_PROD Cost: 939 Bytes: 2,272,380 Cardinality: 37,873 4 TABLE ACCESS FULL TABLE APAPOPR.WAVE_RESULT Cost: 197,063 Bytes: 7,974,414 Cardinality: 189,867 6 INDEX RANGE SCAN INDEX (UNIQUE) APAPOPR.XPKWAVE_RESULT Cost: 82,467 Bytes: 721,495,854 Cardinality: 18,986,733
===========
H3. Version of database information are below to:For wave_id = 51 there are 28466854 rows in "wave_result" table For wave_id = 51 and node_nbr = '0201' and prod_nbr = '0226960' there are 3 rows in "wave_result" table
=========================
Thank you very much!!Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE 11.1.0.7.0 Production TNS for IBM/AIX RISC System/6000: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production
ConcerningFor wave_id = 51 there are 28466854 rows in "wave_result" table For wave_id = 51 and node_nbr = '0201' and prod_nbr = '0226960' there are 3 rows in "wave_result" table
As you mentioned that this particular request is called by a front screen, how different search criteria you get it to show on the front end?
Assuming that if the user is searching just of wave_id = 51 which lines returns to 28466854, it is certainly not a good approach to go look up many records to put end Front end is very light and can not hold many records and will be finally the web server will throw off out of memory exception. Always a limit on the number of records that you retrieve from the database and display it on the front plane.
OR
The second case where the user makes a search by wave_id, node_nbr and prod_nbr, even if she returns to 3 lines, behind the scens, he still made a full scan on the wave_result table. If we go with analytical function, we can reduce a sweep of extra table on the wave_result table. Also the table has millions of lines and the max (version_nbr) seems to be a frequently used on this table sub query. While inserting a record into the table wave_result, you must probably have a calculated value that will tell you its value max and you will choose just the rank of this value, instead of at each time max(). something like below...SELECT ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat, NVL (SUM (ip1.lsu), 0) val FROM ideal_prod ip1, ideal_store s, wave_result wr WHERE ipl.wave_id = 51 AND wr.prod_nbr = ip1.prod_nbr AND wr.wave_id = ip1.wave_id AND wr.wave_id = s.wave_id AND wr.node_nbr = s.node_nbr AND wr.precomputed_max_value = 'MAX' AND NVL (wr.ovrd_dcsn_nm, wr.dcsn_nm) = 'Add' GROUP BY ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat;
-
The two problems with sub form of table, associated with check boxes
Hi all -
Jari already helped me thereby once last week, but I'm running into some new questions.
http://Apex.Oracle.com/i/index.html
workspace: Leppard
username: Guest
PW: app_1000
Application: MyTestApp
Maybe I need to split these into two questions, if so just let me know.
Question 1: On the first tab (tab 1 report) I have a simple tabular presentation based on the EMP table. The column of the box on the far right, when checked restores the Ename column readonly. The problem is that it only works one way. Unchecking the checkbox is not cancel the read-only.
It is javascript code that I have on the page:
The attribute of the element on the checkbox column isfunction test(pThis) { //get the current row index on change var currIndex = $('input[name="'+pThis.name+'"]').index(pThis); // check current items value (return value of lov) if (pThis.value=='Y') { $('input[name="f02"]')[currIndex].style.backgroundColor = "LightGrey"; $('input[name="f02"]')[currIndex].readOnly=true; } else if (pThis.value=='N') { $('input[name="f02"]')[currIndex].style.backgroundColor = "Red"; $('input[name="f02"]')[currIndex].readOnly=false; } }
(It seems to work although I use onClick or onChange so I don't know if that makes a difference).onClick="javascript:test(this);"
But the main problem is that the code does not recognize the value of "n" in the column. I checked with firebug and columns I have untick are definitely on 'n', but I can't get javascript code to recognize this value. Even if I take the "ElseIf" code and just change the first part to (pThis.value ==' no) still does not work. There seems to be something with the value "n" recognize themselves do not, but I can not understand.
Question 2: on the second tab - tab report 2. The same report but this time, I use a javascript character counter similar to that described in the sample application of the Dene (page 276 > http://apex.oracle.com/pls/otn/f?p=31517:276:19207673535900:NO). The counter of characters on the Ename field include javascript and an expression of HTML on the Ename column. The counter works fine, but now, the javascript code to make the column readonly work over all.
Any ideas on these are much appreciated!
Thanks in advance,
John- Please please understand what HTML is generated and how to inspect. Once you do this, you can easily eliminate many problems with selectors not seeming to work. A text box is not an input for example element.
- Boxes rely on the checked, not the value property. Apex circumvents this by creating a hidden extra element which will get the value based on the checked property of the visible checkbox
- Do not use these horrible onchange and onclick attributes :( Use a dynamic action or jQuery to bind events.
- Do not apply a style via javascript. Use CSS for this drive as with jQuery, you can easily add, remove, or toggle the classes too. And if you know jQuery selectors, you can understand css selectors because they are substantially the same.
- I don't know why people insist on using rowIndex or substringing ID. I find it unnecessary and more complex that the alternative (crosses with jQuery)
- The difficulty also in things into action through pagination. Running on just the visible page it of a trifle, but through paging requires more work than just check "fire on loading the page" is not enough. I'm sure you'd want your ENAME either red or gray column and readonly as soon as the page is loaded, and not when you start typing in the box...
- Please please understand what HTML is generated and how to inspect. Once you do this, you can easily eliminate many problems with selectors not seeming to work. A text box is not an input for example element.
Form 1 tab: copied to Page 12 and made my changes here:_
- OnChange on ENAME. This removed. No idea why you would need it there seems a crutch for not having the field in the desired state when the page is loaded.
- OnClick on CHECKBOX. Removed what I hate these attributes. Replaced by a dynamic action.
- Dynamic action "checkbox: ENAME readonly value."
- Event: After refresh
- Selection type: region
- Region: Form of tab 1
- No condition
- Scope of the event: static
- Real Action
- Run the JavaScript Code
- Fire on loading the Page: YES
- Code:
//at page load and after each region refresh: //each: check all checkboxes and set readonly on ename accordingly //click: when the checkbox changes, change ename accordingly $("td[headers='CHECKBOX'] input[type='checkbox']:visible") .each(function(){checkReadonly(this);}) .click(function(){checkReadonly(this);});
- Run the JavaScript Code
- Event: After refresh
function checkReadonly(pCheck){
var lCheck = $(pCheck);
lCheck.closest("tr")
.find("td[headers='ENAME'] input:visible").each(function(){
$(this).prop("readonly", lCheck.prop("checked"));
});
};
td[headers='ENAME'] input{
background-color: red;
}
td[headers='ENAME'] input[readonly]{
background-color: lightgrey;
}
CSS works so much better for this than the application of style through js...
Form 2 tab: copied to Page 13 and made my changes here:_
- OnChange on ENAME. This removed. No idea why you would need this.
- OnClick on CHECKBOX. Removed what I hate these attributes. Replaced by a dynamic action.
- Dynamic action: identical to page 12, just modified trigger area
- Changed input to TEXTAREA when it is required:
- Page > function and global variables declaration
function checkReadonly(pCheck){ var lCheck = $(pCheck); lCheck.closest("tr") .find("td[headers='ENAME'] textarea:visible").each(function(){ $(this).prop("readonly", lCheck.prop("checked")); }); };
- Page > CSS Inline
td[headers='ENAME'] textarea{ background-color: red; } td[headers='ENAME'] textarea[readonly]{ background-color: lightgrey; }
- The f_set_counter function, I changed a bit: there are 2 straps too, put a semicolon at the end of each line.
-Change $x (node) .value $s (node, value) and $v (node)
-changed $x (node) .innerHTML to $(node) .text)
I know: it worked. I like this better. OCD? :/
function f_set_counter(pThis,pLength,pMaxLength,pReset)
{
if (pLength>pMaxLength){
alert('The maximum length of '+pMaxLength+' exceeded.');
$s(pReset, $v(pReset).substring(0,pMaxLength));
$("#"+pThis).text(pMaxLength);
}else{
$("#"+pThis).text(pLength);
};
};
Published by: Tom on February 15, 2013 12:48
Made a mistake in the case of dynamic action :->, click after refresh!
problem with the query insert masking character @.
Hi the gems...I do through xml schema, run... means using a batch file, I'll call the xml files and the xml file contains the names of files containing all the DDLs and LMD...
No problem with the DDL...
now when I run the LMD, all are working well except a few insert scripts...
Insert into TABLE_NAME (EVENT_ID, EVENT_DESC, EVENT_MESSAGE_TEMPLATE, EVENT_MESSAGE_SUBJECT) values (4, 'abcdefgh',)
'Hi,
Order details:
@Order_ID #.
@Instrument_ID #.
This is an automated email. Please do not reply.',
"executed");
This kind of scripts insert failed with the error "[ora: sqlplus] SP2-0310: could not open the file" Order_ID #, .sql.
This problem is due to the @ character before the data...
problem doesn't happen when I run the script explicitly, xml perform only the origin of the problem
So, I need to know if there is a way to hide the sign @...
Please help... Thanks in advance
user12780416 wrote:
"[ora: sqlplus] SP2-0310: could not open the file" Order_ID #, .sql.
In SQL * more the @ character means: run a script. That would explain the error message.
The real problem is that your chain is written on several lines. A string like this might work:
{code}
Insert into TABLE_NAME (EVENT_ID, EVENT_DESC, EVENT_MESSAGE_TEMPLATE, EVENT_MESSAGE_SUBJECT) values (4, 'abcdefgh',)
"Hi," | Chr (10)
||' Order of details :'|| Chr (10)
|' @Order_ID #' | Chr (10)
|' @Instrument_ID #' | Chr (10)
||' This is an automated email. Please do not respond. »
"executed");
{code}
But it might not be a usable workaound.
As you create the string insert sort, you might be able to replace all line breaks in the present with you own custom lines.
Replace (yourEventMessage, Chr (10), "' |) Chr (10): "')
I need to query this xml file:
< a > < action id = "1" > < alarm id = "1000" > 3 < / alarm > < alarm id = '1001' > 2 < / alarm > < alarm id = "31" > 2 < / alarm > < / action > < Code action = "3" > < alarm id = "16" > 5 < / alarm > < / has >
I need to add the action/@id attribute to this query:
select aa.hour,
to_number(extract(value(xa),'alarm/@id')) alm_,
to_number(extract(value(xa),'alarm/text()')) freq_
from t_alarm_stats aa,
xmltable('$XML/a/action/alarm' passing aa.x_alarm AS "XML") xa
where aa.id_device = 3194
and aa.hour > trunc(sysdate-1);
I have now the recordset is fine enough:time, id_alarm and frequency of the alarm:
28/03/2011 01:00 1000 3
28/03/2011 01:00 1001 2
28/03/2011 01:00 31 2
28/03/2011 01:00 16 5
I need to also add the corresponding action/@id, but I don't know how to navigate to a higher level of my xml so that the Recordset:
time, action id, id_alarm and frequency of the alarm:
28/03/2011 01:00 1 1000 3
28/03/2011 01:00 1 1001 2
28/03/2011 01:00 1 31 2
28/03/2011 01:00 3 16 5
Y at - it the possibility to do this with 1 query?
Thanks in advance,
Samuel
Hello
This should do it:
select aa.hour
, xa1.action_id
, xa2.alarm_id
, xa2.alarm_freq
from t_alarm_stats aa,
xmltable('$XML/a/action'
passing aa.x_alarm AS "XML"
columns action_id number path '@id',
alarms xmltype path 'alarm'
) xa1,
xmltable('/alarm'
passing xa1.alarms
columns alarm_id number path '@id',
alarm_freq number path '.'
) xa2
where aa.id_device = 3194
and aa.hour > trunc(sysdate-1)
;
What is the problem with this query in the source
A blank page is region 2. Region1: enter rec_no (-rec_no is varchar2) region2:hide and show that displays one record based on rec_ no region1 entered.The problem is that I get the following error
ORA-06550: line 1, column 7: PLS-00428: an INTO clause in this SELECT statement
Here's my simple query in a process of pl/sql
Start
Select rec_no, rec_name from mytable where rec_no = upper(:P16_rec_no);
end;
Why? The same query works under the sql command.
what I'm trying to accompolish here, it is because he has given huge if I want to display hide also multiples, regions and allow users to update each region as a result. Help, please. It kills me that I just can't understand what is causing the problem to the query. Thank you.
Hello
The list is set to the field EMPLOYEE_ID itself? What is the primary key of the table? In my example, DEPTNO is the primary key and I used the element generated by the wizard page to display the list. The parameters of the Source of the item itself or the column DEPTNO and database so that the process "process line...". "to identify the updated row.
Andy
Performance issue with Sub query
Hi all
I have a requirement as there are two tables.
Columns in the table T1
-----------------------------------
enter_time TIMESTAMP - partitioned column
loc_num INDEX of index column-
Table T2
---------------------------
number of loc_num
VARCHAR2 (20) type1
VARCHAR2 (20) type2
Table T1 is to have 30,00000 files
Table T2 is to have 4 records
There is no application between T1 and T2.
Try to get one day date of the T2 based on the results of query sub.
Query:
SELECT * FROM T1
WHEN trunc (enter_time) = July 22, 15 '
and loc_num IN (select loc_num FROM T2 where = "XYZ" type1 and type2 = "PPP");
I tried with the sup of CO-RELEATED query, but it takes more than 30 minutes.
Do you have any idea to rewrite the query to make it faster in this scénarion.
Thanks in advance.
Kind regards
Sanjib
Hello
Columns in the table T1
-----------------------------------
enter_time TIMESTAMP - partitioned column
loc_num INDEX of index column-
Table T2
---------------------------
number of loc_num
VARCHAR2 (20) type1
VARCHAR2 (20) type2
Table T1 is to have 30,00000 files
Table T2 is to have 4 records
Do you have any idea to rewrite the query to make it faster in this scénarion.
Implementation plan would be useful here.
Assuming that enter_time is indexed, you can remove this trunc function.
select * from t1 where enter_time >= to_date('07/22/2015', 'mm/dd/yyyy') and enter_time < to_date('07/22/2015', 'mm/dd/yyyy') + 1 and loc_num in ( select loc_num from t2 where type1='XYZ' and type2='PPP' )
Problem with the query in the form of customization mode
Hi allCan you please help me I'm getting problem while doing the customization form
Scenario:
Marter dot org form that I need to display the default value in the field of the unit of MEASURE value is null
I succeed while doing all the steps below
Condition tab:
----------------------
Trigger the same: ONCE - NEW - ITEM - INSTANCE
Trigger object: MTL_SYSTEM_ITEMS. INVENTORY_ITEM_MIR
Action tab:
------------------
Type: property
type of object: agenda
Trigger object: MTL_SYSTEM_ITEMS. PRIMARY_UNIT_OF_MEASURE_MIR
Property name: VALUE
Value: null
but the problem is when I try to query (F11) the form, I'm not able to ask please help me with the of this
Thank you
EABR
The problem is, you assign a value to an element when the form is opened, so the form will update mode, so the system not allowing you to make the request (f11). If you clear the value that has been missed, you'd be able to F11.
So instead set the VALUE, try the INITIAL_VALUE property and let me know if this worked for you.
Thank you
Pradeep
PROBLEM WITH SQL QUERY.
Hi allI am executing the following query, which I use to retrieve unique records.
SELECT OH. ORDER_ID, OH. ORDER_DATE, OH. GRAND_TOTAL, OSI. DESCRIPTION ACE ORDER_STATUS,
PMT. DESCRIPTION AS PAYMENT_METHOD, TR. AS PAYMENT_STATUS DESCRIPTION
OF ORDER_HEADER OH INNER JOIN ORDER_PAYMENT_PREFERENCE OPP ON OH. ORDER_ID = OPP. ORDER_ID and
OPP. CREATED_DATE = (SELECT MAX (CREATED_DATE) OF ORDER_PAYMENT_PREFERENCE WHERE THE ORDER_ID = OH. ORDER_ID)
PAYMENT_METHOD_TYPE PMT, STATUS_ITEM SO, STATUS_ITEM OSI
WHERE OPP. PAYMENT_METHOD_TYPE_ID = PMT. PAYMENT_METHOD_TYPE_ID AND
OPP. BATCH = IF. BATCH AND OH. BATCH = OSI. BATCH AND
(OH. BATCH = "ORDER_CREATED" | OH. BATCH = "ORDER_HOLD") AND
OH. "CREATED_STAMP > = ' 2011-12-03 11:41:04.
Problem I am facing is, for some a few order_ids we have several entries in ORDER_PAYMENT_PREFERENCE with CREATED_DATE even where query return me of duplicate records.
I applied OPP. "CREATED_DATE = (SELECT MAX (CREATED_DATE) OF ORDER_PAYMENT_PREFERENCE WHERE THE ORDER_ID = OH. ORDER_ID)' forced to get the record, unique, but as I said to few recordings, we have several lines in ORDER_PAYMENT_PREFERENCE corr. ORDER_ID single and multiple records have same CREATED_DATE.
Can you suggest a few changes, the query to retrieve unique records.
I know I'm a very abstract information, shortly I'll provide table structure and little info I want in this query.
It's because of the tight work schedule.
Thank you
Jagdeep Singh
Hello
Basically, you need to convert a number in his order inside each created_date order_payment_preference. However, if you have more than one created_date which is him even you'll actually choose one of them at random unless you specify an order more squeezed by the clause. For example, you might have a numeric value from a sequence that could be added to determine which input was really the most recent. In any case the following should give you an idea what I mean...
SELECT
order_id,
order_date,
grand_total,
order_status,
payment_method,
payment_status
FROM
(
SELECT oh.order_id,
oh.order_date,
oh.grand_total,
osi.description AS order_status,
pmt.description AS payment_method,
si.description AS payment_status
ROW_NUMBER() OVER(PARTITION BY opp.order_id ORDER BY opp.created_date DESC) rn
FROM order_header oh
JOIN order_payment_preference opp ON oh.order_id = opp.order_id
JOIN payment_method_type pmt ON opp.payment_method_type_id = pmt.payment_method_type_id
JOIN status_item si ON opp.status_id = si.status_id
JOIN status_item osi ON oh.status_id = osi.status_id
WHERE
AND oh.status_id IN('ORDER_CREATED','ORDER_HOLD')
AND oh.created_stamp >= '2011-12-03 11:41:04'
)
WHERE
rn = 1
Some notes if - it is not a good idea to mix the styles of the junction between ansi and oracle style, it makes it difficult to follow. Just choose one or the other.
OH.STATUS_ID='ORDER_CREATED' || OH.STATUS_ID='ORDER_HOLD'
Makes no sense. I took a guess that you meant, OR then I converted to an IN clause that will do the same job.
HTH
David
Dynamic problem with lookup-query for the purpose of resource request
Hi allI need to set up several IOM user exchange mailboxes, I can set up AD account and account of the mailbox without any problem, but only for the first ad and Exchange account. For the second and third, etc. I get the error: "Invalid login name" during Exchange of account provisioning. I discovered that this problem exists with Exchange Connector - it is not able to collect correct GUID. So in my xml Dataset I use dynamic query Lookup to select manually correct Alias, the login name and GUID. The query for the GUID is the sequel (I cloned RO for AD and Exchnage):
AttributeReference available-in-bulk = "true" length = "32" widget = 'search query' type = 'String' attr-ref = "Object GUID" name = "Object GUID" >
* < lookupQuery search-query = "select distinct UD_KFUSER_OBJECTGUID GUID, ud_KFUSER_uid like UD_KFUSER UD_KFUSER, orc orc Login, sta sta where UD_KFUSER.orc_key = orc.orc_key and orc.usr_key = ' $Form data." Take ' and UD_KFUSER. "UD_KFUSER_AD = 27 and orc.orc_status = STA.sta_status AND STA.sta_bucket! = 'Cancelled'" display-field = "GUID" save-field = "Object GUID" / > *.
* < / AttributeReference > *.
My questions are:
1. I have to type * to run the query in the user interface, without * I got error:
+ < 17 February 2012 11:12:22 THIS > < error > < oracle.adfinternal.view.faces.config.ric +.
h.RegistrationConfigurator > < BEA-000000 > < ADF_FACES - 60096:Server Exception durin
PPR, #10 g
oracle.iam.platform.canonic.base.NoteException: an error occurred during executin
g the search query.
to oracle.iam.platform.canonic.agentry.GenericEntityLookupActor.perform)
GenericEntityLookupActor.java:337)
Is this right?
2. when I got correct values (from the search query) - they are missing on the details of the application and form of RO - what Miss me?
I use OIM 11.1.1.5, in my xml dataset I use correct attr-Ref (labels), when I type the values manually, they are propagated to form RO and Exchange mailbox is created.
Best
MP
I not had no problem when writing search query.
This works very well for me.
The request will be filled for the field, so why choose *?
I used as
What is the problem with this query? My head is numb!
Can someone tell me why this request;
< cfquery datasource = "manna_premier" name = "qGetstats" >
SELECT the user name,
UserFirstName,
UserLastName,
LastLogin,
TotalLogins,
UserZone,
TM_Name
USERS
WHERE UserID = ' #. TM_log UserID # '.
< / cfquery >
generates this error message;
Run database query error. | ||||||||
[Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver] Too few parameters. 1 expected. | ||||||||
The error occurred in D:\Inetpub\mannapremier\TM_log_report2.cfm: line 28 | ||||||||
26 : TM_Name 27 : FROM Users 28 : WHERE UserID = "#TM_log.UserID#" 29 : </cfquery> 30 : | ||||||||
|
I see that my variable WHERE comes through but the domain name is not working. I'm sure that the answer is obvious, but it drives me crazy!
Help, please!
I tried and got this result;
No, you now use different data. Now, the user ID is empty, while she was 10120 first.
The only problem seems to be double quotes. To check this, test with
WHERE UserID = 10120
I'm assuming that the userID field to be an integer. If it is text, then use single quotes (not!), as in
WHERE UserID = '#TM_log.UserID#'
I have a question where the upper version value for an id is to be retrieved. I wrote a query but its time consuming. Please help me with this request.
Create feed table (c_id number, number, version number);
create the table of negotiations (identification number, the version number);
Query:
SELECT ID, VERSION
Feed, process t
WHERE a.c_id = 1 and a.id = t.id AND EXISTS (d.SELECT VERSION, d.ID
FROM (SELECT MAX (VERSION), ID
FROM (SELECT ID, VERSION
B power supply, treat the t1
WHERE b.c_id = 1
AND t1.ID = B.ID) c
GROUP BY ID) d
WHERE a.ID = d.ID AND a.VERSION = d.VERSION);
Please check this query:
Select q.id, q.version
from (select f,
DENSE_RANK() over (partition by f.id f.version desc order) rn
power f) q
Join (select *)
(select p,
DENSE_RANK() over (partition by order by p.version desc p.id) rn
process p)
where rn = 1) p
on p.id = q.id
and p.version = q.version
where q.rn = 1
----
Ramin Hashimzade
Problem with the query.
I created these queries, but is based on the number of files w_Candidates_Pending, w_Candidates_Pending_Revoked this status I have to set one flag either 1, 2 or 3.
1 = when 1 or more records for a candidate given pending status,.
2 = when 1 or more records for a candidate given awaiting status revoked.
3 = in another State.
Can u please help me add County in the query and count on the basis, I put 1 one flag.
WITH w_Pending AS
(SELECT resource_status_id
OF ems.resource_status
WHERE resource_status_desc = 'pending '.
),
w_Pending_Revoked AS
(SELECT resource_status_id
OF ems.resource_status
WHERE resource_status_desc = 'revoke pending. "
),
w_Candidates_Pending AS
(SELECT DISTINCT ec.ems_candidate_id,
Eres.resource_status_id,
Eres.candidate_id
Of ems_candidate ec,.
employee_resources eres
WHERE ec.ems_candidate_id = eres.candidate_id (+)
AND eres.resource_status_id = (SELECT resource_status_id FROM w_Pending)
AND eres.through_date IS NULL
),
w_Candidates_Pending_Revoked AS
(SELECT DISTINCT ec.ems_candidate_id,
Eres.resource_status_id,
Eres.candidate_id
Of ems_candidate ec,.
employee_resources eres
WHERE ec.ems_candidate_id = eres.candidate_id (+)
AND eres.resource_status_id = (SELECT resource_status_id FROM w_Pending_Revoked)
AND eres.through_date IS NULL
)
SELECT DISTINCT CND.ems_candidate_id,
CND. Name,
EEJ.ems_job_id,
(SELECT CASE WHEN COUNT (1) = 0 THEN ELSE 'ADD' END 'n')
OF wCP w_Candidates_Pending
WHERE wCP.candidate_id = cnd.ems_candidate_id) pending_flag;
(SELECT CASE WHEN COUNT (1) = 0 'N' THEN ELSE 'REVOKE' END)
OF w_Candidates_Pending_Revoked wCPR
WHERE wCPR.candidate_id = cnd.ems_candidate_id) pending_revoked_flag
OF ems.ems_candidate cnd.
EMS.employee_resources err,
EMS.ems_jobs EJE,
Rsg EMS.resources_group,
EMS. Groups grp
WHERE cnd.ems_candidate_id = err.candidate_id
AND eej.ems_job_id = cnd.ems_job_id (+)
AND err.resource_group_id = rsg.resource_group_id
AND rsg.group_id = grp.group_id
AND err.through_date IS NULL
AND IN grp.group_id
(SELECT DISTINCT grpe.group_id
Groups_employee grpe, employee emp
WHERE grpe.person_id = emp.person_id
AND grpe.person_id = i_logged_in_person_id);
Maybe
Select ems_candidate_id,
name,
ems_job_id,
cases where count_pending > 0 and count_pending_revoke is null
then 1
When count_pending_revoke > 0 and count_pending is null
then 2
When count_pending > 0 and count_pending_revoke > 0
then 3
end indicator
(Select cnd.ems_candidate_id,
CND. Name,
EEJ.ems_job_id,
RSS.resource_status_id,
RSS.resource_status_desc,
ROW_NUMBER() over (partition of cnd.ems_candidate_id
order of rss.resource_status_desc
) rn,.
sum (case rss.resource_status_desc when 'waiting' then 1 end) on
(cnd.ems_candidate_id order of value null partition
lines between unbounded preceding and following unlimited
) count_pending,.
sum (case rss.resource_status_desc when 'pending Revoke' then 1 end) on
(cnd.ems_candidate_id order of value null partition
lines between unbounded preceding and following unlimited
) count_pending_revoke,.
Count (*) over (partition by order cnd.ems_candidate_id by null
lines between unbounded preceding and following unlimited
) count_candidate_rows
of ems.ems_candidate cnd.
EMS.employee_resources err,
EMS.ems_jobs EJE,
Rsg EMS.resources_group,
GRP EMS. Groups,
EMS.resource_status rss
where cnd.ems_candidate_id = err.candidate_id
and eej.ems_job_id = cnd.ems_job_id (+)
and err.resource_group_id = rsg.resource_group_id
and rsg.group_id = grp.group_id
and err.through_date is null
and grp.group_id in (select distinct)
GRPE.group_id
of groups_employee grpe.
employee emp
where grpe.person_id = emp.person_id
and grpe.person_id = i_logged_in_person_id
)
and err.resource_status_id = rss.resource_status_id
)
where rn = 1
Concerning
Etbin
Problem with database querying adapter
Hi allThe polling option treats all rows from a table at a time rather than use the polling frequency. I used an option to update a field (logical deletion) where I've initialized unread value = ' n "and read the value = 'Y'." Now, the problem is that I have to query a single row in the table for every 60 seconds (the second row should be transformed only after 60 seconds), but all the lines are treated at the same time. Can someone let me know what could be the problem?
I put in the db adapter options:
Polling frequency: 60 seconds
Lines by Document XML and database: 1
Lines per transaction database: 1
JDBC, query & Timeout options: 60
Thank you
Please see the below URL, this can help you.
http://www.albinsblog.com/2012/10/DB-adapter-message-throttling-in-Oracle.html#.UQI3_fLDiuk
Concerning
Albin I
[http://www.albinsblog.com/]
Maybe you are looking for
-
Hello, can you tell me what career I need to select on IPhone 7 buy as a gift to a Russian friend? What career would work perfectly here? Thank you very much.
-
I have an old classic iPod and a brand new iMac from 2015. When I connected the iPod to download playlists, I had an ikon on the desktop, momentarily, but then disappeared. I have ikon iPod in the devices menu (version 12.3.3) iTunes, but it will not
-
Re: Satellite A100-768: need help to install an ethernet controller & network
Satellite A100-768 Hello, please help me to install * ethernet controller & network *. Lost my original CD installation CD and hope that the downloaded drivers will do the job but without success... All others (sound, screen, dvd, 1394,...) work very
-
Recently I bought some live maps 3 months and started new accounts... while playing yesterday, my pleasure was interrupted my a message saying that my console has been forbidden to play matchmaking... At the time, I was playing Halo 3, and now I am u
-
Installation Wizard is unable to detect my print server
Hi, I just bought a print server WPSM54g, I have ejecuted the installation wizard and I'll put up the product for the first time. In step 6, that the wizard does not detect the print server and I can't go any further with the installation. I download