order by clause based on the value of the parameter
HelloI use reports 6i with db 10 g
I need to create a report sorted in the order of four fields. There is a field selection parameter which should come first in the order by clause.
IE the user has available to display the report in a sorted order selected
Assume that the four fields are emp_id, name, dept_id desig.
If the user selects dept_id, then the order by clause should be in order of dept_id emp_id, name, desig
Please help solve this scenario.
Thank you
Hi Clement,.
Use the query as follows:
select column_name1, column_name1, ....
from table_name
&order_by_clause
Now in the trigger AFTER-PARAMETER-SHAPE has the order by clause below according to requirements:
if :sort_column = dept_id then
:order_by_clause := 'order by dept_id,emp_id,name,desig';
else
:order_by_clause := 'order by emp_id, dept_id, name,desig';
end if;
Here's sort_column setting user who will be selected by the user, provide the list of values for it.
Hope this helps
Best regards
Arif Khadas
Tags: Oracle Development
Similar Questions
-
dynamic logic in SQL WHERE clause based on the value of the ELEMENT
Hello
I have a report based on the following SQL query.
Thank youselect dept_no, dept_name, dept_loc from dept where dept_loc = :P1_DEPT_LOC // If P1_DEPT_LOC is not null, I want the WHERE clause and IF P1_DEPT_LOC is null, then I don't need the WHERE clause. // how can I build this logic in same SQL
Deepak
Published by: Deepak_J on March 11, 2010 16:37where: P1_DEPT_LOC IS NULL or dept_loc =: P1_DEPT_LOC
If dept_loc is not null better would be
where dept_loc = coalesce(:P1_DEPT_LOC,dept_loc)
-
Where conditional Clause based on the length of the field
Hello people,
I tried to search for this scenario in OTN and not been able to find any success so I will post the question here.
I have two tables - with the detail records and the other being a table of codes. I need to join these two tables based on the code and the length of the code. Let me explain using examples.
Scripts for creating the table and inserts
As you can see that patients * 1001 * and * 1002 * have no codes in the Master table. In this case, I want only the first 3 characters of the ILLNESS_CODES table.create table ILLNESS_CODES(illness_code varchar2(4), illness_description varchar2(100)); create table PATIENT_TB(patient_id varchar2(4), primary_cause varchar2(4)); insert into illness_codes values('B10', 'Flu'); insert into illness_codes values('B30', 'Hepatitis'); insert into illness_codes values('B301', 'Hepatitis A'); insert into illness_codes values('B302', 'Hepatitis B'); insert into illness_codes values('B303', 'Hepatitis C'); insert into patient_tb values ('1001', 'B101'); insert into patient_tb values ('1002', 'B102'); insert into patient_tb values ('1003', 'B30'); insert into patient_tb values ('1004', 'B301'); insert into patient_tb values ('1005', 'B302'); insert into patient_tb values ('1006', 'B302'); insert into patient_tb values ('1007', 'B303'); insert into patient_tb values ('1008', 'B30');
However, for B30, it has a Code and the same for B301, B302 B303 where I would meet the description based on the exact code.
Example of output
Thanks in advance!Patient ID Illness Description ===================================== 1001 Flu 1002 Flu 1003 Hepatitis 1004 Hepatitis A 1005 Hepatitis B 1006 Hepatitis B 1007 Hepatitis C 1008 Hepatitis
SELECT p.*, NVL ( (SELECT illness_description FROM ILLNESS_CODES I WHERE i.illness_code = p.primary_cause), (SELECT illness_description FROM ILLNESS_CODES I WHERE i.illness_code = SUBSTR (p.primary_cause, 1, 3))) FROM PATIENT_TB p;
-
Choose the value based on the parameter range
Hi all
Thanks in advance
I have a table tableaa
what I need to do
(1) if the parameter according to table below is 1 then I need to choose
only every 3 ranks
AN AVERAGE OF END TEACHER BEG
---------- ---------- ---------- ---------- ----------
3 0.2 0.3 159 159
6 0.3 0.4 250 250
9 0.4 0.5 388 388
(2) if the parameter according to table below is 2 so I need to choose
only every 6 row table
AN AVERAGE OF END TEACHER BEG
---------- ---------- ---------- ---------- ----------
6 0.3 0.4 250 250
create table tableaa (a number, beg, number, end, teacher number, average number);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (1, 0,.1, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (2,.1,.2,, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (3,.2,.3,, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (4,.1,.2, 250, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (5,.2,.3, 250, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (6,.3,.4, 250, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (7,.2,.3, 388, 388);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (8,.3,.4, 388, 388);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (9,.4,.5, 388, 388);
commit;This query, you can get what you need:
SELECT * FROM TABLEAA WHERE DECODE ( :parameter , 1 , MOD(A,3) , MOD(A,6) ) = 0
The sample output:
SQL > exec :parameter := 1; PL/SQL procedure successfully completed. SQL > SELECT * 2 FROM TABLEAA 3 WHERE DECODE 4 ( 5 :parameter 6 , 1 7 , MOD(A,3) 8 , MOD(A,6) 9 ) = 0 10 / A BEG END PROF AVERAGE ---------- ---------- ---------- ---------- ---------- 3 .2 .3 159 159 6 .3 .4 250 250 9 .4 .5 388 388 SQL > exec :parameter := 2; PL/SQL procedure successfully completed. SQL > SELECT * 2 FROM TABLEAA 3 WHERE DECODE 4 ( 5 :parameter 6 , 1 7 , MOD(A,3) 8 , MOD(A,6) 9 ) = 0 10 / A BEG END PROF AVERAGE ---------- ---------- ---------- ---------- ---------- 6 .3 .4 250 250
-
Conditional WHERE clause based on the input of parameter
When the restriction of data based on a parameter I generally use the following syntax:
AND p.start_date = NVL (p_start_date, p.start_date)
so IF the parameter is null, THEN I join only on itself, OTHERWISE we filter on parameter.
New requirement means greater than or equal to, so I tried this:
AND THE CASE
WHERE (p_start_date = NULL) THEN
p.start_date = p.start_date
ON THE OTHER
p.start_date > = p_start_date
END;
but, at least, is syntactically incorrect.
Any suggestions?
Thank you!Do not use = with NULL - change IS null
-
Oracle ADF fill drop-down based on the parameter
Hi all
I was faced with a scenario where we want the values in a drop of water down to be limited based on something special... For example, if the Department user ID. If this value exists in the view object that displays data and when I have my LOV it works very well to restrict the LOV based on the service id of the user.
However, if this value is not in the object view we use to display the form as well as the LOV values then I can get the value list to be limited. I tried to run with params and a few other things (this works to restrict data on the page, but not the LOV).
Advice on how I can limit a LOV based on a value that is not in the current t would be great.
Thank you
SHello
If it is a model based on the value list, you can filter the list with a criterion for the view. This point of view criteria can use a variable of liaison for the filtering of the list. The value of the variable binding type is adjustable to the expression. You can then use Groovy as adf.source.applicationModuleName.ViewObjectInstanceName('DepartmentId') to access a ViewObject instance in the same AM. I did not have the exact syntax in head but answered a similar question yesterday
Frank
-
Grouping and sorting data based on the parameter
Hello
I need to display the total total Sub for cost element that is based on the setting in Excel format
If value = 1 then (subtotal of manufacturing) and sorting by Date of receipt, organization, production, item Code
If value = 2, then (subtotal per organization) and sort by organization, serial number
and at the end of the report should show total full
is it possible in excel using the output of the xml below, please guide me if I need to change the way to get the XML output or can be achieved using this.
Please find the XML, thanks in advance
<? XML version = "1.0"? >
<! - generated by the Oracle version 6.0.8.27.0 reports - >
< ASWRECDTREP >
< LIST_G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
< Serial_number > 90699100802262 < / Serial_number >
< ITEM_CODE > OM906LA.007 < / ITEM_CODE >
< DESCRIPTION > MERCEDES SERIES 900 OFF-Highway ENGINE 205 KW 0852 < / DESCRIPTION >
SEA < MANUFACTURER > < / MANUFACTURER >
INDL < APPLICATION > < / APPLICATION >
< ITEM_COST > 15009.09 < / ITEM_COST >
< MATERIAL_COST > 685.25 < / MATERIAL_COST >
< > 1001395 PO_NUMBER < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 22 May 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
EUR < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 7431.3 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 10 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PARTS < / ORGANISATION_NAME >
< Serial_number > 90699100802285 < / Serial_number >
< ITEM_CODE > OM906LA.007 < / ITEM_CODE >
< DESCRIPTION > MERCEDES SERIES 900 OFF-Highway ENGINE 205 KW 0852 < / DESCRIPTION >
SEA < MANUFACTURER > < / MANUFACTURER >
INDL < APPLICATION > < / APPLICATION >
< ITEM_COST > 15009.09 < / ITEM_COST >
< MATERIAL_COST > 685.25 < / MATERIAL_COST >
< > 1001395 PO_NUMBER < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 22 May 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
EUR < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 7431.3 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 30 < / ORGANIZATION_CODE >
Melbourne < ORGANISATION_NAME > < / ORGANISATION_NAME >
< Serial_number > 6520107896 < / Serial_number >
< ITEM_CODE > 3500.010 < / ITEM_CODE >
< DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E018179 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 11126.11 < / ITEM_COST >
< MATERIAL_COST > 664.23 < / MATERIAL_COST >
< PO_NUMBER > 971515 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 14 April 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 8063.3 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 30 < / ORGANIZATION_CODE >
Melbourne < ORGANISATION_NAME > < / ORGANISATION_NAME >
< Serial_number > 6510869062 < / Serial_number >
< ITEM_CODE > 3200.010 < / ITEM_CODE >
< DESCRIPTION > ALLISON 3000 SERIES WE HWY TRANSMISSION E017944 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 11853.57 < / ITEM_COST >
< MATERIAL_COST > 707.66 < / MATERIAL_COST >
< PO_NUMBER > 982120 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 12 May 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 8251.6 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 40 < / ORGANIZATION_CODE >
Brisbane < ORGANISATION_NAME > < / ORGANISATION_NAME >
G6003 D6002 < Serial_number > < / Serial_number >
SERIES.002 < > 520 ITEM_CODE < / ITEM_CODE >
< DESCRIPTION > KONRAD 520 SERIES MARINE STERN DRIVE < / DESCRIPTION >
OTH < MANUFACTURER > < / MANUFACTURER >
HUSBAND < APPLICATION > < / APPLICATION >
< ITEM_COST > 9296.95 < / ITEM_COST >
< MATERIAL_COST > 482.91 < / MATERIAL_COST >
< PO_NUMBER > 1009062 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 24 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 6939.29 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 40 < / ORGANIZATION_CODE >
Brisbane < ORGANISATION_NAME > < / ORGANISATION_NAME >
ABC123 < Serial_number > < / Serial_number >
< ITEM_CODE > GM20541 - KP1.001 < / ITEM_CODE >
GENERATOR KOHLER < DESCRIPTION > < / DESCRIPTION >
KOH < MANUFACTURER > < / MANUFACTURER >
Collage < APPLICATION > < / APPLICATION >
< > 756.83 ITEM_COST < / ITEM_COST >
< MATERIAL_COST >.78 < / MATERIAL_COST >
< PO_NUMBER > 1015156 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 14 October 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
AUD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 20 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 40 < / ORGANIZATION_CODE >
Brisbane < ORGANISATION_NAME > < / ORGANISATION_NAME >
ABC124 < Serial_number > < / Serial_number >
< ITEM_CODE > GM20541 - KP1.001 < / ITEM_CODE >
GENERATOR KOHLER < DESCRIPTION > < / DESCRIPTION >
KOH < MANUFACTURER > < / MANUFACTURER >
Collage < APPLICATION > < / APPLICATION >
< > 756.83 ITEM_COST < / ITEM_COST >
< MATERIAL_COST >.78 < / MATERIAL_COST >
< PO_NUMBER > 1015156 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 14 October 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
AUD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 20 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
06R1017763 < Serial_number > < / Serial_number >
< ITEM_CODE > 6062HK30.005 < / ITEM_CODE >
< DESCRIPTION > DETROIT SERIES 60 ENGINE SAILOR 615 KW 2949322 < / DESCRIPTION >
DDM < MANUFACTURER > < / MANUFACTURER >
HUSBAND < APPLICATION > < / APPLICATION >
< ITEM_COST > 99125.34 < / ITEM_COST >
< MATERIAL_COST > 2028.31 < / MATERIAL_COST >
< PO_NUMBER > 883339 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 5 March 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 63768 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6310935001 < / Serial_number >
< ITEM_CODE > 2500.003 < / ITEM_CODE >
< DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 4855.33 < / ITEM_COST >
< MATERIAL_COST > 306.39 < / MATERIAL_COST >
< PO_NUMBER > 1000221 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 1 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6310935002 < / Serial_number >
< ITEM_CODE > 2500.003 < / ITEM_CODE >
< DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 4855.33 < / ITEM_COST >
< MATERIAL_COST > 306.39 < / MATERIAL_COST >
< PO_NUMBER > 1000221 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 1 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6310935003 < / Serial_number >
< ITEM_CODE > 2500.003 < / ITEM_CODE >
< DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 4855.33 < / ITEM_COST >
< MATERIAL_COST > 306.39 < / MATERIAL_COST >
< PO_NUMBER > 1000221 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 1 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6510876301 < / Serial_number >
< ITEM_CODE > T350R.004 < / ITEM_CODE >
< DESCRIPTION > ALLISON TORQMATIC WE HWY TRANSMISSION < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 9465.69 < / ITEM_COST >
< MATERIAL_COST > 597.33 < / MATERIAL_COST >
< PO_NUMBER > 1005777 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 6936.3 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6510876302 < / Serial_number >
< ITEM_CODE > T350R.004 < / ITEM_CODE >
< DESCRIPTION > ALLISON TORQMATIC WE HWY TRANSMISSION < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 9465.69 < / ITEM_COST >
< MATERIAL_COST > 597.33 < / MATERIAL_COST >
< PO_NUMBER > 1005777 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 6936.3 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6510876303 < / Serial_number >
< ITEM_CODE > T375R.002 < / ITEM_CODE >
< DESCRIPTION > ALLISON TORQMATIC WE HWY TRANSMISSION < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 10224.19 < / ITEM_COST >
< MATERIAL_COST > 645.19 < / MATERIAL_COST >
< PO_NUMBER > 1005777 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 7433.3 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6310940354 < / Serial_number >
< ITEM_CODE > 2500.003 < / ITEM_CODE >
< DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 4855.33 < / ITEM_COST >
< MATERIAL_COST > 306.39 < / MATERIAL_COST >
< PO_NUMBER > 1005777 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6310940355 < / Serial_number >
< ITEM_CODE > 2500.003 < / ITEM_CODE >
< DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 4855.33 < / ITEM_COST >
< MATERIAL_COST > 306.39 < / MATERIAL_COST >
< PO_NUMBER > 1005777 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6310940356 < / Serial_number >
< ITEM_CODE > 2500.003 < / ITEM_CODE >
< DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 4855.33 < / ITEM_COST >
< MATERIAL_COST > 306.39 < / MATERIAL_COST >
< PO_NUMBER > 1005777 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 6310940357 < / Serial_number >
< ITEM_CODE > 2500.003 < / ITEM_CODE >
< DESCRIPTION > ALLISON 2000 SERIES ON HWY TRANSMISSION E016189 < / DESCRIPTION >
ATD < MANUFACTURER > < / MANUFACTURER >
ONHY < APPLICATION > < / APPLICATION >
< ITEM_COST > 4855.33 < / ITEM_COST >
< MATERIAL_COST > 306.39 < / MATERIAL_COST >
< PO_NUMBER > 1005777 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 23 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 3574.9 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< G_ASW_REC_DATE >
< ORGANIZATION_CODE > 70 < / ORGANIZATION_CODE >
< ORGANISATION_NAME > NDC - PRODUCT < / ORGANISATION_NAME >
< Serial_number > 5272003543 < / Serial_number >
< ITEM_CODE > T1637K33.002 < / ITEM_CODE >
< DESCRIPTION > DETROIT SERIES 4000 ENGINES INDUSTRIAL 1865 KW 2456291 < / DESCRIPTION >
DDM < MANUFACTURER > < / MANUFACTURER >
MNIG < APPLICATION > < / APPLICATION >
< ITEM_COST > 420083.16 < / ITEM_COST >
< MATERIAL_COST > 3785.85 < / MATERIAL_COST >
< PO_NUMBER > 921170 < / PO_NUMBER >
< TRANSACTION_RECEIPT_DATE > 30 June 09 < / TRANSACTION_RECEIPT_DATE >
< VENDOR_LOT_NUM > < / VENDOR_LOT_NUM >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< PO_UNIT_PRICE > 301549 < / PO_UNIT_PRICE >
< / G_ASW_REC_DATE >
< / LIST_G_ASW_REC_DATE >
< / ASWRECDTREP >
Best regards
Mahihttp://winrichman.blogspot.com/2009/10/subtemplating.html
There you go.
-
How to change template name based on the parameter in bipublisher
Hi all
I want to change the model based on the selected report parameter.
For example: If A is selected it should use a model, if B is selected it should use the B model.
Thank you
KSSHII,
can you clarify pls.
If you have any what example it would help me a lot... I use a model RICH in BIpublisher.Published by: André on November 12, 2009 20:10
-
you place your order of rows based on the values
Hello
I have two tables for example: emp1 emp2 and
Published by: vishnu prakash on Sep 8, 2010 04:40emp1 AD_NAME VD COURSE_NOS ------------------------------ AD1 100 3 AD2 2 2 AD3 50 5 emp 2 AD_NAME COURSE ------------------------- AD1 C1 AD1 C2 AD1 C3 AD2 C1 AD2 C2 AD3 C1 AD3 C2 AD3 C3 AD3 C4 AD3 C5 i want to order the ad_name of emp2 based on highest vd order of emp1 but the order should be for alternative vd like AD1 100 AD3 50 AD2 2 AD1 100 AD3 50 AD2 2 . . . AD3 50
You mean, more like this...
SQL> ed Wrote file afiedt.buf 1 with emp1 as (select 'AD1' as ad_name, 100 as vd, 3 as course_nos from dual union all 2 select 'AD2', 2, 2 from dual union all 3 select 'AD3', 50, 5 from dual union all 4 select 'AD4', null, 2 from dual) 5 ,emp2 as (select 'AD1' as ad_name, 'C1' as course from dual union all 6 select 'AD1', 'C2' from dual union all 7 select 'AD1', 'C3' from dual union all 8 select 'AD2', 'C1' from dual union all 9 select 'AD2', 'C2' from dual union all 10 select 'AD3', 'C1' from dual union all 11 select 'AD3', 'C2' from dual union all 12 select 'AD3', 'C3' from dual union all 13 select 'AD3', 'C4' from dual union all 14 select 'AD3', 'C5' from dual union all 15 select 'AD4', 'C1' from dual union all 16 select 'AD4', 'C2' from dual) 17 -- 18 -- END OF TEST DATA 19 -- 20 select ad_name, vd, course_nos, course 21 from ( 22 select emp1.ad_name, vd, course_nos, course 23 ,row_number() over (partition by emp1.ad_name order by decode(vd,null,1,0), course) as crn 24 from emp1 join emp2 on (emp1.ad_name = emp2.ad_name) 25 ) 26* order by decode(vd,null,1,0), crn, vd desc nulls last SQL> / AD_ VD COURSE_NOS CO --- ---------- ---------- -- AD1 100 3 C1 AD3 50 5 C1 AD2 2 2 C1 AD1 100 3 C2 AD3 50 5 C2 AD2 2 2 C2 AD1 100 3 C3 AD3 50 5 C3 AD3 50 5 C4 AD3 50 5 C5 AD4 2 C1 AD4 2 C2 12 rows selected. SQL>
?
-
Order by clause dynamic based on the Oracle
How can I order by dynamic Clause based on the Oracle
My query of sql function returns with SYS_REFCURSOR. and I will place the order of column as an input parameter
Published by: user10736825 on December 22, 2010 11:34create or replace FUNCTION TEST_SSK ( p_srot number ) RETURN SYS_REFCURSOR AS C_testssk SYS_REFCURSOR; BEGIN OPEN C_TESTSSK FOR SELECT LOAN_CODE,LOAN_DATE,DUE_DATE,LOAN_AMT FROM LOAN_MASTER order by P_SROT; return C_testssk; end;
I think this would work without dynamic sql.
You could do something like:
... OPEN C_TESTSSK FOR SELECT LOAN_CODE,LOAN_DATE,DUE_DATE,LOAN_AMT FROM LOAN_MASTER order by decode(P_SROT,1,loan_code,2,loan_date,3,due_date,4,loan_amt); ...
P_SROT is the number of the order by column.
-
How does the order by clause in oracle 10G?
Hi This is my table called Master.I want to order by sno. so I run the below mentioned query.
SNO DESC STIME, ETIME CCODE ADD SID
11 11 11 1 10 s11
1 1 s1 09:00 12:00 10
2 2 s2 06:00 07:00 9
3 3 S3 9:00 23:00 0
SELECT * FROM MASTER BY SNO
SNO DESC STIME, ETIME CCODE ADD SID
1 1 s1 09:00 12:00 10
11 11 s11 11 1 10
2 2 s2 6:00 7:00 9
3 3 S3 09:00 23:00 0
but I had bad results. Help kindly me.i can't understand how the order by clause is fetching the record.
Hello
Most probably because that SNO is not digital, but a tank.
If it contains a number onlly, try
SELECT * FROM MASTER BY TO_NUMBER (SNO);
-
Problem in the SQL because of the order by clause
Hi all
I am facing a problem in a sql query. I use Oracle 10 g 2.
Query is given below:
The query Plan is:SELECT t1.ename FROM T1, T2 WHERE T1.EMPNO = 1234 AND T1.ACCOUNTNO = T2.ACCOUNTNO AND T1.SEQ = T2.SEQ ORDER BY T2.SEQ
Now, I want to reduce the time of this request..---------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 2 | 218 | 11716 (1)| 00:00:41 | |* 1 | TABLE ACCESS BY INDEX ROWID | T1 | 1 | 89 | 1 (0)| 00:00:01 | | 2 | NESTED LOOPS | | 2 | 218 | 11716 (1)| 00:00:41 | |* 3 | TABLE ACCESS BY INDEX ROWID| T2 | 2 | 40 | 11715 (1)| 00:00:41 | | 4 | INDEX FULL SCAN | PK_T2_SEQ | 58752 | | 122 (5)| 00:00:01 | |* 5 | INDEX RANGE SCAN | FK_ACCOUNTNO | 3 | | 0 (0)| 00:00:01 | ----------------------------------------------------------------------------------------------------
If I remove order by clause query that the query performance is quite perfect, but with order by clause its take time.
I already set SORT_AREA_SIZE, but still nothing improves.
Welcome and thank you for your suggestions.
Thank you
Published by: BluShadow on June 23, 2011 07:55
addition of {noformat}{noformat} tags and formatted explain plan to make it readable. Please see {message:id=9360002} for details on how to post code and data
Hey, a quick test, try:
select ename from ( SELECT t1.ename, T2.SEQ FROM T1, T2 WHERE T1.EMPNO = 1234 AND T1.ACCOUNTNO = T2.ACCOUNTNO AND T1.SEQ = T2.SEQ and rownum > 0) ORDER BY SEQ
Amiel Davis
-
ORDER BY a column with NULL values only
Hello
The order of column has all null values for the results of my query set.
Ex:
Select a, b, c from table1 where type = 'type1' and ID = "id1" order by column1
In the above query, "column1" contains nulls for 'type1 '. The order of the records in the result set is different for different ID values if the values of a, b and c are always the same.
What is happening in the 10g database.
I have also observed that the order of the records for the same query conforms in the 9i database.
(1) is the difference due to the difference in versions of database?
(2) is there a way to get the order even records independently entry ID?
(3) I cannot in the same order in 10 g DB too as the order in 9i DB?
Thank you.Hello
Madhuri says:
HelloThe order of column has all null values for the results of my query set.
Ex:
Select a, b, c from table1 where type = 'type1' and ID = "id1" order by column1
In the above query, "column1" contains nulls for 'type1 '. The order of the records in the result set is different for different ID values if the values of a, b and c are always the same.
What is happening in the 10g database.I have also observed that the order of the records for the same query conforms in the 9i database.
If two or more rows have the same values (or NULL) for each ORDER BY expressions, then you may not be sure what order they will be. The system is free to do whatever he finds convenient. What the system identifies Dresser can vary depending on many factors, including the version, the size of the table, the conditions in the WHERE clause, there is a GROUP BY clause, or not... In all cases, it is not something that you can depend on. If you want the output in a certain order, to specify the order in the ORDER BY clause.
(1) is the difference due to the difference in versions of database?
Could be. In all versions, Oracle said that you cannot count on the order being compatible, except if the ORDER BY clause, it is consistent.
(2) is there a way to get the order even records independently entry ID?
Add more expressions at the end of the ORDER BY clause, as tie-breakers.
For example:ORDER BY column1 , a , b , c
If table1 is really a table (not a view), you can add a ROWID.
In most cases, you can ORDER BY expressions that are not in the SELECT clause. So if you have a primary key, you can usually ORDER BY it, even if you don't see it.(3) I cannot in the same order in 10 g DB too as the order in 9i DB?
Of course, ORDER BY works the same in all versions. If you have an ORDER BY clause to unambiguously, the output will be exactly the same order in any version.
Remember that the absence of ORDER BY has no effect in all versions. If you have an ORDER BY of ambiguous clause, you can not count on the coming out in a particular order in any version. -
Cannot wrap a select with order by clause in a file.
TOGETHER SET TERMOUT OFF FEEDBACK OFF PAGESIZE 0 400 LINESIZE ECHO OFF OFF POSITION
coil & 1;
Select "EMPID, EMP_NAME, REGION, FROM, TO, MONTH, ACTIVITY_TYPE, PROJECT_PIN, MILESTONE_NAME, PRACTICE_ID, RESOURCE_CATEGORY, HOURS, COMMENT, percent ALLOCATION, INVOICE_TO, the STATE of the double"
Union of all the
select empid,resource_name,region,week_of,(week_of+7),core_month,bill_rate,project_name,project_type,milestone_name,practice_id,resource_category,total_hours_submitted,project_type,"%ALLOCATION",invoice_to,status from master_emp_allocation order by week_of;
spool off;
"exit";
/
the above block gives result below
select empid,resource_name,region,week_of,(week_of+7),core_month,bill_rate,project_name,project_type,milestone_name,practice_id,resource_category,total_hours_submitted,project_type,"%ALLOCATION",invoice_to,status from master_emp_allocation order by week_of
*
ERROR at line 3:
ORA-00904: "WEEK_OF": invalid identifier
---------------------------------------------------------------------------
Without the order by clause it wraps the file passed as an argument.
check
Combining the UNION AGENDA and BY
Columns in the ORDER BY list must be a subset of the columns in the selection list on the left side of the union.
All the columns in the ORDER BY list should be sorted in ascending order, and they must be a prefix in the order of the columns in the target of the left side of the UNION list.
-
lov filter based on the setting of the page
Dear all,
I'm having a selectOne on page and filter lov based on the parameter(as queryString) page so how I have applied?
I created a Vo and also affected the bind variable. but it does not work... someone can help me on this...
-Thank you
Published by: Santosh Vaza January 7, 2011 19:55Here's an example of how you can set your VO to have only specific lines that you want before the loading of the page:
http://blogs.Oracle.com/Shay/2010/10/passing_parameters_to_adf_appl.html
Maybe you are looking for
-
How do I know if my Time Capsule causing my intermittent internet service or if it is my ISP?
-
Not enough space for upgrade to Windows 10
I just bought a Tablet W1-810 yesterday. I have not installed all the programs again, because I wanted to update the Windows 10 Tablet first. I installed a 32 GB memory card. I downloaded 10 Windows via Windows Update of Windows'. BUT: When the Table
-
ProBook b 6560: driver missing for 'Base system device' x 3
Hi all I am currently using the second PCIe slot in the laptop (ProBook 6560 b), but it does not recognize everything that connects to it. Any connected device shows as Base system device in Device Manager: PCI Slot 2 (bus PCI 36, device 0, function
-
QNX will replace the Blackberry OS?
I have read a few forums, they said, QNX will replace Blackberry OS is this true?, then what the developer Java Blackberry supports, if new QNS will support legacy java blackberry applications
-
Hi, I installed Sourcefire_3D_Device_Virtual64_VMware - 5.3.0 - 571 on vmware ESXi 5.0, installation was ok, I can ping and ssh Sourcefire_3D access but I am not able to access via Internet Explorer or Firefox. I see with wireshark who receive the So