Help required in generating the following query
Hi all,
i need solution regarding the following problem.
we got many number of groups ,each group containg many number of names,each name containing some items under that
i had written a query stating that select item where grp =[0%] and name =[1%] from a table
it will execute and dispaly a window with two fields at the first field i entered group and in the second field when i select for existing values it shows all the items of all groups
but we need only items that belong to the group that we enter in the first field
any one tell me the query regarding this requirement
HI,
The alternative solution is: develop your add-on, which get the filtering window, and connects the 2 parameters inside, then runs the query and displays it in a matrix/Grid.
It is not takes so many time.
Regards,
J.
Similar Messages
-
Please help me by solving the following query
hi download the image from the above link and here i want latest dosi line count.....
Please help meI think you don't need a plsql for this purpose ... you can find the sub total & final total in the query itself like
select
DOSI,
ELEMENT_TYPE,
SUM(USED) USED
from
DOEMS_LICENSE_SUMMARY
where
DOSI in (DOSILIST)
GROUP BY
rollup(ELEMENT_TYPE, DOSI) ** duplicate** -
Need help in the following query
Hi ,
I have the following query to pull out data for a particular timeperiod( campaign)
select
da.acct_nr,smas.mrkt_id,smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
,smas.stf_ind,da1.acct_nr,
smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
,smas.stf_ind,da1.acct_nr,prev.*
From cdw.sum_mrkt_acct_sls smas
join codi.dim_acct da
on (smas.mrkt_id = da.mrkt_id and smas.acct_key = da.acct_key)
join codi.dim_acct da1
on (smas.mrkt_id = da1.mrkt_id and smas.UPLN_acct_key = da1.ACCT_KEY)
where smas.acct_key in
select dwnln_acct_key from codi.dim_ldrshp_genlgy
where mrkt_id = 66 and fld_sls_cmpgn_perd_id = 20100304
and root_upln_acct_key = (select acct_key from codi.dim_acct where acct_nr = '0032622' and mrkt_id = 66)
and
smas.mrkt_id = 66
and smas.fld_sls_cmpgn_perd_id = 20100304
and smas.sls_org_key <> -100
order by 1
So this query will pull out data for campaign 20100304
No i want to modify the query to pull out data for 3 such campaigns.
for a smas.acct_key
so data will
smas.acct_key all the data for 1st campaign , all the data for 2nd campaign. all the data for 3rd campaign
Could you please help in modifying this query.
ThanksHow about this ??
select da.acct_nr,
smas.mrkt_id,
smas.fld_sls_cmpgn_perd_id,
smas.acct_key,
smas.upln_acct_key,
smas.awrd_sls_amt,
smas.fld_net_sls_amt,
smas.stf_ind,
da1.acct_nr,
smas.fld_sls_cmpgn_perd_id,
smas.acct_key,
smas.upln_acct_key,
smas.awrd_sls_amt,
smas.fld_net_sls_amt,
smas.stf_ind,
da1.acct_nr,
prev.*
From cdw.sum_mrkt_acct_sls smas
join codi.dim_acct da on (smas.mrkt_id = da.mrkt_id and
smas.acct_key = da.acct_key)
join codi.dim_acct da1 on (smas.mrkt_id = da1.mrkt_id and
smas.UPLN_acct_key = da1.ACCT_KEY)
where smas.acct_key in (select dwnln_acct_key
from codi.dim_ldrshp_genlgy
where mrkt_id = 66
and fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
and root_upln_acct_key =
(select acct_key
from codi.dim_acct
where acct_nr = '0032622'
and mrkt_id = 66))
and smas.mrkt_id = 66
and smas.fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
and smas.sls_org_key - 100
order by 1 -
Help required in optimizing the query response time
Hi,
I am working on a application which uses a jdbc thin client. My requirement is to select all the table rows in one table and use the column values to select data in another table in another database.
The first table can have maximum of 6 million rows but the second table rows will be around 9000.
My first query is returning within 30-40 milliseconds when the table is having 200000 rows. But when I am iterating the result set and query the second table the query is taking around 4 millisecond for each query.
the second query selection criteria is to find the value in the range .
for example my_table ( varchar2 column1, varchar2 start_range, varchar2 end_range);
My first query returns a result which then will be used to select using the following query
select column1 from my_table where start_range < my_value and end_range> my_value;
I have created an index on start_range and end_range. this query is taking around 4 millisseconds which I think is too much.
I am using a preparedStatement for the second query loop.
Can some one suggest me how I can improve the query response time?
Regards,
ShyamTry the code below.
Pre-requistee: you should know how to pass ARRAY objects to oracle and receive resultsets from java. There are 1000s of samples available on net.
I have written a sample db code for the same interraction.
Procedure get_list takes a array input from java and returns the record set back to java. You can change the tablenames and the creteria.
Good luck.
DROP TYPE idlist;
CREATE OR REPLACE TYPE idlist AS TABLE OF NUMBER;
CREATE OR REPLACE PACKAGE mypkg1
AS
PROCEDURE get_list (myval_list idlist, orefcur OUT sys_refcursor);
END mypkg1;
CREATE OR REPLACE PACKAGE BODY mypkg1
AS
PROCEDURE get_list (myval_list idlist, orefcur OUT sys_refcursor)
AS
ctr NUMBER;
BEGIN
DBMS_OUTPUT.put_line (myval_list.COUNT);
FOR x IN (SELECT object_name, object_id, myvalue
FROM user_objects a,
(SELECT myval_list (ROWNUM + 1) myvalue
FROM TABLE (myval_list)) b
WHERE a.object_id < b.myvalue)
LOOP
DBMS_OUTPUT.put_line ( x.object_name
|| ' - '
|| x.object_id
|| ' - '
|| x.myvalue
END LOOP;
END;
END mypkg1;
[pre]
Testing the code above. Make sure dbms output is ON.
[pre]
DECLARE
a idlist;
refc sys_refcursor;
c number;
BEGIN
SELECT x.nu
BULK COLLECT INTO a
FROM (SELECT 5000 nu
FROM DUAL) x;
mypkg1.get_list (a, refc);
END;
[pre]
Vishal V. -
Problem in finding Exact result by using the following Query
Hello,
I am finding difficulty in producing the required result by using the following Query in Reports 6i
(Note: - The query actual output and the required output are as follows: -)
SELECT
DISTINCT
SH.S_HEAD_CODE,
B.BILL_ID,
B.SANCTION_DATE,
E.EMP_NAME,
E.EMP_DESIGNATION,
B.TOTAL_BILL,
NVL((SH.INITIAL_ALLOCATION-B.TOTAL_BILL), 0) BALANCE
FROM BILL B, PARAMETERS P,SUB_HEAD SH, EMPLOYEES E, BILL_DETAIL BD
WHERE
SH.S_HEAD_CODE=B.S_HEAD_CODE
AND B.S_HEAD_CODE=BD.S_HEAD_CODE
AND B.EMP_ID_NO=E.EMP_ID_NO
AND B.BILL_ID=BD.BILL_ID
The Output of the above query is as follows: -
Let say we have Total Amount Sanctioned Rs. 15,000,00/-
Name Total Bill (Rs.) Balance (Rs.)
Sohail 7147 1492853
Saqib 2131 1497869
Amir 6802 1493198
Shafiq 1214 1498786
Note:- In the above output the above query is subtracting the current balance from Total Sanctioned Amount (Rs. 1500000) each time, but
it should actually subtract the current bill amount from the previous balance like the below said result.
Name Total Bill (Rs.) Balance (Rs.)
Sohail 7147 1492853 {Previous Balance - Current Bill Amount (1500000-7147) }........ The previous balance was actual amount Rs. 1500000
Saqib 2131 1490722 {Previous Balance - Current Bill Amount (1492853 - 2131)}
Amir 6802 1483920 {Previous Balance - Current Bill Amount (1490722 - 6802)}
Shafiq 1214 1482706 {Previous Balance - Current Bill Amount (1483920 - 1214)}
Results Continue...........................
Please help me to solve this problem.
Thank you in advancejust check if this meets your requirements,
SQL>
SQL> With t As
2 (
3 Select 'Sohail' c1 ,7147 c2 ,1492853 c3 From dual Union All
4 Select 'Saqib' ,2131 ,1497869 From dual Union All
5 Select 'Amir' ,6802 ,1493198 From dual Union All
6 Select 'Shafiq' ,1214 ,1498786 From dual
7 )
8 Select c1,
9 c2,
10 prv_amt - c2 current_amt
11 From
12 (
13 Select c1,
14 c2,
15 c3,
16 lag(c3,1,1500000) over(Order By c3) prv_amt
17 From t
18 );
C1 C2 CURRENT_AMT
Sohail 7147 1492853
Amir 6802 1486051
Saqib 2131 1491067
Shafiq 1214 1496655
SQL> -
How to add a receipt number in the following Query for PO Report
Hi Guys,
I need a help regarding following query.
Its a PO report for 11.5.10.2
select distinct pv.segment1 supplier_number,
pv.vendor_name supplier_name,
pha.segment1 po_number,
pha.revision_num revision_num,
pha.authorization_status po_status,
to_char(pha.creation_date, 'DD/MM/YYYY') creation_date,
pha.currency_code currency_code,
pla.sum_amount_ordered sum_amount_ordered,
pda.sum_quantity_ordered sum_quantity_ordered,
pda.sum_amount_received sum_amount_received,
pda.sum_quantity_received sum_quantity_received,
(pla.sum_amount_ordered - pda.sum_amount_received) sum_accrued, --AVI
( pda.sum_quantity_ordered - pda.sum_quantity_received) quantity_accrued, --AVi
to_char(rsl.date_receipt, 'DD/MM/YYYY') date_receipt,
-- rsl.receipt_num receipt_number,
ppa.segment1 project_code, ppa.project_status_code, --10.0.0.4
aia.invoice_num invoice_num,
aia.invoice_date invoice_date, --AVI
aia.creation_date invoice_creation_date, --AVI
aia.amount invoice_amount_allocated_to_po, --AVI
pla.purchase_basis,
pla.category_id,
-- pda.item_description,
haou.name organisation, --10.0.0.3
pda.sum_quantity_billed sum_quantity_billed , --10.0.0.3
gcc1.CONCATENATED_SEGMENTS,
gcc2.CONCATENATED_SEGMENTS
from po_headers_all pha,
po_vendors pv,
pa_projects_all ppa,
hr_all_organization_units haou,
(select po_header_id,
sum(quantity * unit_price) sum_amount_ordered,
org_id,
purchase_basis,
category_id
-- pla.item_description,
from po_lines_all
group by po_header_id, org_id
, purchase_basis,
category_id
-- pla.item_description
) pla,
(select pla.po_header_id,
pda.project_id,
sum(pda.quantity_ordered) sum_quantity_ordered,
sum(pda.quantity_delivered * pla.unit_price) sum_amount_received,
sum(pda.quantity_delivered) sum_quantity_received,
sum(pda.quantity_billed) sum_quantity_billed, --10.0.0.3
accrual_account_id
from po_distributions_all pda, po_lines_all pla
where pla.po_line_id = pda.po_line_id
group by pla.po_header_id, pda.project_id,accrual_account_id
) pda,
(select po_header_id, charge_account_id,
-- rsh.receipt_num,
min(rsl.creation_date) date_receipt
from rcv_shipment_lines rsl
where rsh.SHIPMENT_HEADER_ID=rsl.SHIPMENT_HEADER_ID
group by po_header_id,charge_account_id
) rsl,
(select distinct aia.invoice_num, pda.po_header_id , aia.invoice_date --10.0.0.3
, aia.creation_date , sum(aida.amount) amount
from po_distributions_all pda,
ap_invoice_distributions_all aida,
ap_invoices_all aia
where pda.po_distribution_id = aida.po_distribution_id(+)
and aia.invoice_id(+) = aida.invoice_id
Group by
aia.invoice_num, pda.po_header_id , aia.invoice_date --10.0.0.3
, aia.creation_date) aia,
(select haou2.organization_id, haou2.name
from fnd_flex_value_sets ffvs,
fnd_flex_value_norm_hierarchy ffvnh,
fnd_flex_values_vl ffvv,
hr_all_organization_units haou1,
FND_FLEX_VALUE_CHILDREN_V ffvcv,
hr_all_organization_units haou2
where ffvs.FLEX_VALUE_SET_NAME = 'CAP_CODE_BU'
and ffvs.FLEX_VALUE_SET_ID = ffvnh.flex_value_set_id
and ffvnh.parent_flex_value like 'PO%'
and ffvv.FLEX_VALUE_SET_ID = ffvnh.flex_value_set_id
and ffvv.FLEX_VALUE between ffvnh.child_flex_value_low and ffvnh.child_flex_value_high
and substr(haou1.name, 1, Instr(haou1.name, '-')) =
substr(ffvv.DESCRIPTION, 1, Instr(ffvv.DESCRIPTION, '-'))
and haou1.organization_id = fnd_global.org_id
and ffvcv.parent_flex_value = ffvnh.parent_flex_value
and ffvcv.flex_value_set_id = ffvs.flex_value_set_id
and substr(haou2.name, 1, Instr(haou2.name, '-')) =
substr(ffvcv.DESCRIPTION, 1, Instr(ffvcv.DESCRIPTION, '-'))
union --10.0.0.1
select f.organization_id, f.name --10.0.0.1
from hr_all_organization_units f --10.0.0.1
where f.organization_id = fnd_global.ORG_ID --10.0.0.1
) bu
, po_line_locations_all plla --10.0.0.4
, gl_code_combinations_kfv gcc1
,gl_code_combinations_kfv gcc2
where pv.vendor_id = pha.vendor_id
and pla.po_header_id = pha.po_header_id
and pda.po_header_id = pha.po_header_id
and pha.po_header_id = rsl.po_header_id(+)
and pda.project_id = ppa.project_id(+)
and pha.po_header_id = aia.po_header_id(+)
and aia.po_header_id = pha.po_header_id
and pla.org_id = haou.organization_id
and pha.authorization_status in ('APPROVED', 'OPEN')
and plla.po_header_id = pha.po_header_id --10.0.0.4
and plla.closed_code in ('APPROVED', 'OPEN', 'CLOSED FOR INVOICE', 'CLOSED FOR RECEIVING', 'CANCELLED') --10.0.0.4
and bu.organization_id = haou.organization_id
AND gcc1.code_combination_id = pda.accrual_account_id
AND gcc2.code_combination_id =rsl.CHARGE_ACCOUNT_ID
In the following query I have commented receipt_num using the table rcv_transaction_headers.
If I uncomment it the query results huge number of unexpected report.
How can I add receipt number to the following query?
Should I use rcv_transactions. If yes, what would be the join conditions.
Kindly help as its urgent.
Thanks in advance.
Regards
AvijitSandeep is correct. I don't have time to tell you the correct query, but mine is something like this based on Sandeep's information:
SELECT rsh.receipt_num
FROM rcv_transactions rcvt,
po_lines_all pla,
rcv_shipment_headers rsh
WHERE rcvt.shipment_header_id = rsh.shipment_header_id
AND rcvt.PO_LINE_ID = pla.PO_LINE_ID
AND pla.item_id = (select distinct inventory_item_id
from mtl_system_items
where segment1 = '1216107-2') -
Issue converting the following query to text.
Hello guys, I'm trying to convert the following query to text and to use PRINT so that it returns theresult in the picture as output, help would be appreciated, thanks :)SELECT EventName, EventDate
FROM EventTable
ORDER BY EventDate DESC;This is an example, As I said it is not a good approach
set nocount on
declare @tab table(id int,txt varchar(100));
declare @txt varchar(1000);
declare @count int;
insert into @tab
values(1,'Text 1'),(2,'Text 2'),(4,'Text 4');
select *,RN=ROW_NUMBER()OVER(ORDER BY (SELECT NULL)) into #temp from @tab
select @count=@@ROWCOUNT;
while @count>0
begin
select @txt =right(replicate(' ',50)+convert(varchar(50),ID),50) +
right(replicate(' ',50)+convert(varchar(50),txt),50)
from #temp where RN=@count
set @count=@count-1
print @txt
end
drop Table #temp
Satheesh
My Blog |
How to ask questions in technical forum -
Hello every one, can I rewrite the following query without using the 'ROW_NUMBER() OVER ' part.
The query is supposed to pull out the records whose CODE is not NULL and has most
recent date for UPDATE_DATE . The reason I wanted to do this is, When I embed this query
in between many other queries along with JOINs, My oracle server is unable to execute. So, I thought
its better to supplant 'ROW_NUMBER() OVER ' logic with something else and try it. .
SELECT a.* FROM
(SELECT b.*, ROW_NUMBER() OVER (PARTITION BY b.PIDM
ORDER BY b.UPDATE_DATE DESC) AS Rno
FROM
SELECT *
FROM SHYNCRO WHERE CODE IS NOT NULL
)b
)a
WHERE a.Rno = 1Hi,
You didn't write over 150 lines of code and then start testing it, did you?
Don't.
Take baby steps. Write as little as pssiblem test that. Debug and test again until you have something that does exactly what you want it to do.
When you have somehting that works perfectly, take one baby step. Add a tiny amount of code, maybe 1 or 2 lines more, and test again.
When you do get an error, or wrong results, you'll have a much better idea of where the problem is. also, you won't be building code on a flimsy foundation.
If you need help, post the last working version and the new version with the error. Explain what you're trying to do in the new version.
The error message indicates line 133. It looks like line 133 of your code is blank. Does your front end allow completely blank lines in the middle of a query? SQL*Plus doesn't by default; you have to say
SET SQLBLANKLINES ONto have a completely blank line in SQL*Plus. (However, lines containing nothing but at commnet are always allowed.)
You may have noticed that this site normally doesn't display multiple spaces in a row.
Whenever you post formatted text (such as indented code) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
The 4 people who posted small code fragments for you to read all did this. It would be so much easier for people to read your humongeous query if it were formatted. -
Can u write the following query without using group by clause
select sp.sid, p.pid, p.name from product p, supp_prod sp
where sp.pid= p.pid and
sp.sid = ( select sid from supp_prod group by sid
having count(*) =(select count(*) from product));
thru this, we retrieving all the products delivered by the supplier.
Can you write the following query without using the group by clauseselect sp.sid, p.pid, p.name
from product p, supp_prod sp
where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
maybe if you can post some sample data and output will help us understand what you want to achieve. -
ICommand required to call the Xacute query
SCM380
SAP MII - Manufacturing-
Integration and Intelligence -
Basics
Solution 17: Using Transactions on a Web
Page
Task:
Use the "Addition" transaction to complete the source text on the page shown
below, which displays the result in a message box. The iCommand required to call
the Xacute query is already implemented on the page, so you only have to enter
the JavaScript code for the calculation.
Number1 TextBox
Number2 TextBox
Calculate Button
Does any body have the code syntax for res_Calculator.irpt?
SCM380_Resources_EN/WEB/UNIT4/Lesson2/Exercise3/ folder in the
WEB tab
I seem to have lost the CD
Thank you,Hi,
For check your java console view the link:
http://www.holomatix.com/knowledgebase/frequently-asked-questions/how-do-i-display-my-java-console?/
change the code:
<form name="frmMain" action id="frmMain">
For
<form name="frmMain" id="frmMain" on submit="return false;">
<input type="submit" value="Calculate" name="Result" />
For
<input type="button" value="Calculate" name="Result" on click="calculate()" />
For more details about html view the link http://www.w3schools.com/html/
Hope this help.
Danilo Santos
Edited by: Danilo Santos on Nov 16, 2011 4:26 PM
Edited by: Danilo Santos on Nov 16, 2011 4:28 PM -
How Can I make the following query faster
Hi Guru
I want your valuable suggestion to make the following query faster.I did not write all required columns list. I gave here all those columns where I have conditon like decode,case when,or subquery
(SELECT CASE WHEN REPORTED_BY IS NULL THEN
(SELECT INITCAP(EMP_NAME) FROM HR_EMP WHERE EMP_NO = M.EMP_NO_RADIO)
ELSE (SELECT INITCAP(EMP_NAME) FROM HR_EMP WHERE EMP_NO = M.REPORTED_BY) END RADIOLOGIST_NAME,
(SELECT TEAM_NAME FROM DC_TECHTEAMMST WHERE TEAM_NO = M.GROUP_NO) GROUP_NAME,
CASE WHEN M.RESULT_ENTRY_LOCK_BY IS NOT NULL THEN 'R'
WHEN M.REPORT_DONE = 'D' THEN 'D'
WHEN M.REPORT_DONE = 'P' THEN 'P'
WHEN M.REPORT_DONE = 'F' THEN 'F'
WHEN NVL(M.IMG_CAPTURED,'X') NOT IN ('B','Y') OR M.QA_RESULT = 'F' THEN 'S'
WHEN NVL(M.IMG_CAPTURED,'X') IN ('B','Y') AND NVL(M.QA_RESULT,'X') NOT IN ('B','P') THEN 'Q'
wHEN NVL(M.IMG_CAPTURED,'X') IN ('B','Y') AND NVL(M.QA_RESULT,'X') IN ('B','P') THEN 'C'
END STATUS,
(SELECT DECODE(NVL(V.DELIVERY_STATUS,'N'),'E',3,'U',2,1)
FROM FN_VOUCHERCHD V WHERE V.VOUCHER_NO = M.VOUCHER_NO AND V.ITEM_NO = M.TEST_NO) DELIVERY_STATUS,
trunc((start_time-order_end)*24,0)||' hr'||':'||
decode(length(trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0)),2,to_char(trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0))
,1,to_char('0'||trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0)))||' mi' duration_order_capture,
DECODE(R.CONFIDENTIAL_PATIENT,'Y','*',NVL(R.NAME,R.name_lang_name||' '||R.name_lang_fname)) PAT_NAME,
FNC_PATIENTAGE(R.REG_NO,'',R.CONFIDENTIAL_PATIENT) pat_age,
DECODE(R.CONFIDENTIAL_PATIENT,'Y','*',R.PATIENT_SEX) PAT_SEX
FROM DC_MODALITYAPPOINTMENT M,DC_TESTMST T,OP_REGISTRATION R
WHERE M.ACCESSION_NO IS NOT NULL AND NVL(M.CANCEL_FLAG,'N') = 'N'
AND (NVL(T.SP_GEN,'S') = 'S' OR NVL(M.DOC_REQ_GEN,'N') = 'Y')
AND M.TEST_NO IS NOT NULL AND M.TEST_NO = T.TEST_NO AND M.REG_NO = R.REG_NO)
How can I make the above query faster.
Query condition or indexing whatever is preferable please guide me.
The approximate data of tables
DC_MODALITYAPPOINTMENT 2,000,000
A lot of updating is going on some columns of this table.all columns are not in the select list, Insertion is happend in batch process by back-end trigger of another table.
Primary key based one column,
OP_REGISTRATION 500,000
Daily insertion on this table around 500 records,updation is not much.
Primary key based one column 'reg_no'
DC_TESTMST
Total records of this table not more than 1500.This is setup table. Insertion and updation is not much on this table also
I have to create a view based on this query .
and I have to create another view to serve another purpose.
In the 2nd view I need this query as well as I need another query by using union all operator based on a table(dc_oldresult)
which have 1,600,000 records.There is no DML on this table
SELECT NVL((SELECT USER_DEFINE_TEST_NO FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1 ),SV_ID) USER_D_EXAM_NO,
(SELECT TEST_TYPE FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1 ) EXAM_TYPE,
NVL((SELECT TEST_NAME FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1),'Exam Code: '||sv_id) EXAM_NAME,
(SELECT PAT_NAME FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_NAME,
(SELECT PAT_AGE FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_AGE,
(SELECT PAT_SEX FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_GENDER
FROM DC_OLDRESULT
WHERE HN IS NOT NULL AND SV_ID IS NOT NULL AND UPPER(ACTIVE) = 'TRUE'
Should I make join DC_OLDRESULT, OP_REGISTRATION and DC_TESTMST? or The eixisting subquery is better?
I use OP_REGISTRATION and DC_TESTMST in both query
Thanks in advance
MokaremWhen your query takes too long ...
-
How to generate the following XML-Output?
Hi all,
I would like to generate the following XML-Output without defining any types or tables:
<?xml version = '1.0'?>
<DEPARTMENTS_EMPLOYEES>
<DEPARTMENT NAME="ACCOUNTING">
<DEPTNO>10</DEPTNO>
<LOC>NEW YORK</LOC>
<EMPLOYEES_OF_DEPARTMENT>
<EMPNO>...</EMPNO>
<ENAME>...</ENAME>
</EMPLOYEES_OF_DEPARTMENT>
</DEPARTMENT>
<DEPARTMENT NAME="RESEARCH">
<DEPTNO>20</DEPTNO>
<LOC>DALLAS</LOC>
<EMPLOYEES_OF_DEPARTMENT>
</EMPLOYEES_OF_DEPARTMENT>
</DEPARTMENT>
</DEPARTMENTS_EMPLOYEES>
Unfortunately the following SQL-Statement does not working:
select xmlElement("DEPARTMENTS_EMPLOYEES",
xmlAttributes(d.deptno as "DEPTNO"),
xmlElement("DNAME", d.dname),
xmlElement("LOC", d.loc),
xmlElement("EMPLOYEES_OF_DEPARTMENT",
(select xmlAgg(xmlElement("EMPLOYEE", xmlAttributes(e.empno as "EMPNO"), xmlForest(e.ename as "ENAME", e.job as "JOB", e.hiredate as "HIREDATE", e.sal as "SAL", e.comm as "COMM", m.empno as "MGRNO", m.ename as "MGRNAME" ) )
from emp e, emp m
where e.deptno = d.deptno
and m.empno = e.mgr
) as XML
from dept d;
1. When I provide this statement with SQL*Plus
(unfortunately 9.0.1.3.0) then I get the
following output:
XML()
XMLTYPE()
XMLTYPE()
XMLTYPE()
XMLTYPE()
2. When I provide this statement with SQL Navigator
4.3.0.456 then I get the following error:
[1]: (Error): OCI-21560: argument 3 is null, invalid,
or out of range
3. When I execute the following PL/SQL-Code then I get
the XML-Error message:
DECLARE
x CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
x := dbms_xmlquery.getxml('select xmlElement("DEPARTMENT",
xmlAttributes(d.deptno as "DEPTNO"),
xmlElement("DNAME", d.dname),
xmlElement("LOC", d.loc),
xmlElement("EMPLOYEELIST",
(select xmlAgg(xmlElement("EMPLOYEE",
xmlAttributes(e.empno as "EMPNO"),
xmlForest(e.ename as "ENAME",
e.job as "JOB",
e.hiredate as "HIREDATE",
e.sal as "SAL",
e.comm as "COMM",
m.empno as "MGRNO",
m.ename as "MGRNAME"
from emp e, emp m
where e.deptno = d.deptno
and m.empno = e.mgr
) as XML
from dept d');
xmlstr := dbms_lob.SUBSTR(x,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
4. When I provide the following PL/SQL-Code then I get the same xml-error:
DECLARE
x CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
x := dbms_xmlquery.getxml('select xmlElement("SYSDATE", xmlElement("Datum", to_char(sysdate,''DD.MM.YYYY'')),
xmlElement("Zeit", to_char(sysdate,''HH24:MI:SS''))) as XML
from dual');
xmlstr := dbms_lob.SUBSTR(x,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: Unimplemented Feature</ERROR>
Can I generate the needed XML-Output from Database with SQL or PL/SQL?
Can anybody help me?
Regards
Leonid PavlovI have this done with:
DECLARE
qryCtx DBMS_XMLGEN.ctxHandle;
result CLOB;
xmlstr VARCHAR2(32767);
line VARCHAR2(2000);
BEGIN
qryCtx := dbms_xmlquery.newContext('select deptno, dname, loc, cursor(select e.empno, e.ename, e.job,
to_char(e.hiredate,''DD.MM.YYYY'') hiredate, e.sal, e.comm,
m.empno MGRNO, m.ename MGRNAME
from emp e, emp m
where e.deptno = dept.deptno
and m.empno(+) = e.mgr) emp
from dept');
dbms_xmlquery.useNullAttributeIndicator(qryCtx, FALSE);
dbms_xmlquery.setRowsetTag(qryCtx, 'DEPARTMENTS_EMPLOYEES');
dbms_xmlquery.setrowtag(qryCtx, 'DEPARTMENT');
DBMS_XMLQuery.setRowIdAttrName(qryCtx, 'ID');
DBMS_XMLQuery.setRowIdAttrValue(qryCtx, 'DEPTNO');
-- dbms_xmlquery.setrowidattrname(qryCtx, NULL);
result := dbms_xmlquery.getXML(qryCtx);
DBMS_XMLQuery.closeContext(qryCtx);
xmlstr := dbms_lob.SUBSTR(result,32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR(xmlstr,1,INSTR(xmlstr,CHR(10))-1);
DBMS_OUTPUT.PUT_LINE(line);
xmlstr := SUBSTR(xmlstr,INSTR(xmlstr,CHR(10))+1);
END LOOP;
END;
But how can I rename the <EMP>-Element to Employees? -
The following query failed: GetUserProfileByName - with the wrong username
I have 2 users (out of 800), who run into this issue on occasion. Their username is 'fccs\user1' in the profile db, and in every UserInfo table in the system. But when they try to go to certain sites or open an infopath form, this error gets thrown:
The following query failed: GetUserProfileByName (User: FCCS\[email protected], Form Name: Template, IP: , Connection Target: , Request: http://fccsteams/sites/DataManagement/Tasks/Lists/Tasks/Folders1.aspx?RootFolder=/sites/DataManagement/Tasks/Lists/Tasks/2013/11&, Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2013-08-05T23:14:53:458Z Type: DataAdapterException, Exception Message: The remote server returned an error: (500) Internal Server Error. Operation Failure ---> Access Denied: To create a user profile, you must be an administrator, or create your own profile and have personal features rights. UnauthorizedAccessAccess Denied: To create a user profile, you must be an administrator, or create your own profile and have personal features rights. The remote server returned an error: (500) Internal Server Error.)
Notice how the username is now the entire email address and not just the username. I have no idea why it thinks that that is their username. Any ideas?Hi,
According to your post, my understanding is that you got query failed error.
Melick had written a blog said that the form access the user profile web service (Userprofileservice.asmx) using UDC
file.
You can check whether the UDC connection was still pointing to root site.
You can change this file to match with the sub site collection. Otherwise there may be a cross domain access issue.
There are similar threads for your reference.
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/9c2f7f4c-0fa9-43bd-94b1-1d7075e35841/5566-error-with-getuserprofilebyname-and-infopah-browser-forms-using-claims-based-authentication
http://social.msdn.microsoft.com/Forums/en-US/49753330-40c0-4327-9a9b-2c3304a74e67/sharepoint-infopath-and-populating-forms-with-ad-data?forum=sharepointcustomizationlegacy
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
The entity with header id(2) generated the following errors
Hi all,
While Implementing in Maintenance Workbench am receiving this error message" The entity with header id(2) generated the following errors".
Although after the error, half of the work orders have been implemented. that means if there are 12 scheduled works in that 6 have been implemented. Please explain dis. We r using R12.0.6Hi,
Can you find any details about the error in the log files?
Regards,
Hussein -
Write the following query using JOIN keyword ?
Qest:
Write the following query using JOIN keyword ?
select ID_category from category_master X
where Exist(select 1 from sub_category Y where
X.ID_category=Y.ID_category)Edited by: 799660 on Oct 3, 2010 6:05 AMselect X.ID_category
from category_master X join (select distinct ID_category from sub_category) Y
on (X.ID_category=Y.ID_category)
/SY.
Maybe you are looking for
-
Concerns w/ MSI fx5600XT 256 Card
I am looking for a video card to go with my New MSI kt6 deltaLSR mobo w/ 2500 barton chip I have 1 GIG of samsung (512x2) PC3200 400MHz Dual Channel DDR sdram waiting for the Mobo to arrive I have 2 concerns about what was a soon to be purch
-
Hidden photos still appear in all photos album
Hi In the new iPhoto when I hide photos they still appear in the All Photos album and will not hide , this is very inconveinant can somebody tell me if this is a bug or intentional and if so is there a work around. thx
-
Hi Experts, My client is looking for two additional fields to be added in to standard report IWBK. I want to know whether it is possible to add below mentioned additional fields to IWBK. If yes how? Is there any user exit or BADI available for the sa
-
Changing log file name (weblogic.log)
-
I need help with a textArea which wont implement a JScrollpane
I have created a text area, but when the words get to the bottom there is no scrollbar. I tried implementing the scrollpane to the text area, but it doesnt work. I added it to a panel, then the panel to the frame. (Here are the snippits of coding tha