Doubt function to_char (date, 'month')
Hello
Hope you have a great day.
I have an installation of forms (Forms11gr2 11.1.2.2 64 bit on Red Hat EL 6 64 bit) where I have a forms module, where I am using the following code, which should return the name of the month in Spanish but he returns in English:
RESULTADO := TO_CHAR(TO_DATE('10/10/2014','DD/MM/YYYY'),'MONTH');
If I run the previous code on SqlDeveloper, it returns the month in Spanish without problem, but it seems that I should do something else either on the side of Weblogic.
The database version is 11.2.0.3 64 bit.
What should I do?
Concerning
Carlos
You must set the NLS_LANG variable in your EPS file ("default.env" If you don't change it) on the appropiately weblogic server.
Tags: Oracle Development
Similar Questions
-
How to convert Date months in the database that points to the EBS, DWH not.
Hi friends,
We intend to create reports in OBIEE and the Source is EBS. This means that we do not want depends on Datawarehouse and Informatica and OBIApps. Simply create us some reports and that they refer to the EBS database.
End of test, we took an HR report and it contains under columns:
Months (Sun)
Revenue by Division (Fact)
Average cost per numbers of workforce (Fact)
In my little survey, we found that the income column is of EBS: GL_BALANCES. And we have configured the base of W_Day_D table in DAC has no column months in EBS (not sure).
Come to my problem, how can I call the month column in my data base stressed EBS. How to convert the Date months in my database.
I can deceive me, but someone please look into this... How can I create columns for this exact report of OBI in EBS database instead of DwH.
Thanks in advance...
Raghu Jen7782Just confused here.
Hang on, if I get it, you want to create report based on columns of EBS directly then using rt BI applications?
There is then no question of using the W_DAY_D table then.
Follow
As long as you have Date column, you can use DB functions to convert them into months (just use the string SUBSTR to extract the month and the year).
Create your own query instead of using the tables of BI APPS and try to bring a hybrid product.Sorry I'm wrong in the understanding of your needs, if I had properly then do the steps above.
Mark correct or useful if this can help,
Kind regards
Rayan Vieira -
Behavior of $ facsimile in function TO_CHAR
Hello
Length of the column in the table number iis-status_cid (3).SELECT status_cid, LENGTH (status_cid) len, TO_CHAR (status_cid, '$99') status_cid_1, LENGTH (TO_CHAR (status_cid, '$99')) len_1 FROM status Result STATUS_CID LEN STATUS_CID_1 LEN_1 1 1 $1 4 15 2 $15 4
My doubt is why there are spaces in the alias column status_cid_1 while $ facsimile is used in the function to_char top of the query.
Thanks in advance.
Kind regards
PrakashThat's the negative symbol
a number can be negative...
http://Nuijten.blogspot.com/2011/09/quick-how-long-is-this-string.html
Published by: Alex Nuijten on March 19, 2012 13:21
-
Is function like the function of date and time picker in the ICB 8.5?
I need the function as "date and time picker control" used in activeX, but my operating system (windows 7 Bits without office software) is not the «Microsoft date controller» and time picker I am looking article in the internet which mention this register the MSComctl2.ocx in the windows\system32, but he could not operator in my operating system (it's not allow to save the controller). Help me, please.
Already, I discovered that the problem on the service of DTP in the 64-bit Windows 7 could not used. Because, the DTP is 32 bits, it should use the administrator to register the 'mscomct2.ocx file' which must be replace in the % windows/SysWOW64 and used the 'mscomct2.ocx regsvr32.exe"in console windows.
-
the sidebar calendar shows like orange, no date, month
the sidebar calendar shows like orange, no date, month
the sidebar calendar shows like orange, no date, month
Double-click on an empty place.
-
How to get the Date, month, year of the DateTimePicker
Hi, I am using the DateTimePicker.
There are several question about this command:
1. how to get the Date, month and year?
-With the help of myDateTime.value, I get this string ' Wed May 08 14:45 ICT 2013 '-> I have to manually analyze this? Because I need in format yyyy/mm/dd. Or can set the format of dateTimePicker.value?
2 format on dateTimePicker self (on the user interface) is d/m/YY, I can't change to another format?
Thank you
dateTimePicker.value return a QDateTime not a string.
https://developer.BlackBerry.com/Cascades/reference/bb__cascades__datetimepicker.html#property-value
See more:
https://developer.BlackBerry.com/Cascades/reference/QDateTime.html#date
https://developer.BlackBerry.com/Cascades/reference/QDate.html
You can get
day = dateTimePicker.value.date().day() month = dateTimePicker.value.date().month() year= dateTimePicker.value.date().year() dateYYYYMMDD = dateTimePicker.value.date().toString(Qt::ISODate) dateYYYYMMDD2 = dateTimePicker.value.date().toString("YYYY/MM/DD") dateYYYYMMDD3 = dateTimePicker.value.toString("YYYY/MM/DD")
-
Overload function "value data" problem on DataGrid Renderer button
Hi all, I hope it is something simple.
I have a class that extends the mx.controls.Button mx.core.IDataRenderer and implements. I need to set the icon of the button whenever the Data property has the value of the data grid. My problem is that my set/get overloaded function of data are never called (I reinforced with the debugging code). Instead the set/get in Container.as functions (3.4 the Flex SDK kit) called.
Here's the Basic code:
exportButtonRenderer.as package controls
{
import flash.events.Event;
import flash.events.MouseEvent;
Import mx.controls.Button;
Import mx.core.IDataRenderer;
Import mx.controls.dataGridClasses.DataGridListData;
Import mx.controls.listClasses.BaseListData;
Import mx.events.FlexEvent;
Import mx.controls.Alert;
Import model.descriptors.compDescriptor;
Import events.exportClickedEvent;
public class exportButtonRenderer extends button implements IDataRenderer
{
Embed your icons
[(Embed(source='/assets/icons/export.png')]
[Bindable]
public static var imageExport: Class;
[(Embed(source='/assets/icons/blank.png')]
[Bindable]
public static var imageBlank: Class;
public void exportButtonRenderer()
{
Super();
}
private var _listData:DataGridListData;
override public function get listData (): BaseListData
{
Return _listData;
}
override public function set listData(value:BaseListData):void
{
_listData = DataGridListData (value);
}
private var _data:Object;
public override function get data (): Object
{
return _data;
}
override public function set data(value:Object):void
{
_data = value;
}
override the clickHandler(event:MouseEvent):void function
{
super.clickHandler (event);
}
}
}Now I know that I am using the Flexlib TreeGrid and not a standard DataGrid but when I trace through all the code all code firing the set/get functions is in any case the DataGrid control.
Here is the my def grid in my main application mxml:
Header 1 < flexlib:TreeGrid
ID = "MKTXGrid".
dragEnabled = 'false' sortableColumns = 'false' showRoot = "false".
(disclosureClosedIcon="@Embed(source='/assets/icons/arrow_right.png')".
(disclosureOpenIcon="@Embed(source='/assets/icons/arrow_down.png')".
(folderOpenIcon="@Embed(source='/assets/icons/psd.png')".
(folderClosedIcon="@Embed(source='/assets/icons/psd.png')".
Click = "MKTXGrid_clickHandler (Event)" "
doubleClickEnabled = "true" doubleClick = "MKTXGrid_doubleClickHandler (event)" left = "0" right = "0" top = low "0" = "16" > "
< flexlib:columns >
< flexlib:TreeGridColumn dataField = "Name" headerText = "Name" minWidth = "200" width = "200" editable = "true" / >
< mx:DataGridColumn dataField = 'ExportName"headerText ="Export Name"/ >
< mx:DataGridColumn dataField = "Export" headerText = "Export" width = "50" minWidth = "20" resizable = "false" >
< mx:itemRenderer >
< mx:Component >
< mx:Box horizontalAlign = "center" width = "100%" verticalScrollPolicy = "off" horizontalScrollPolicy = "off" >
(< contrôles: exportButtonRenderer label = «Exporter» icon="@Embed(source='assets/icons/export.png')" width = "12" height = "12" useHandCursor = "true" >
< controls: Click >
<! [CDATA]
Import events.exportClickedEvent;
var e:exportClickedEvent = new exportClickedEvent();
e.itemData = data;
dispatchEvent (e);
[]] >
< / controls: Click >
< / controls: exportButtonRenderer >
< / mx:Box >
< / mx:Component >
< / mx:itemRenderer >
< / mx:DataGridColumn >
< / flexlib:columns >
< / flexlib:TreeGrid >
Nothing too special happens.I know it can be done, I've seen examples in the SDK:
Either incidentally, I reinforced with the code in the TreeGridItemRenderer class in Flexlib which works correctly and the class def starts like this:
TreeGridItemRenderer.as import flash.display.DisplayObject;
to import flash.display.InteractiveObject;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
to import flash.geom.Point;
import flash.geom.Rectangle;
Import flexlib.controls.TreeGrid;
Import mx.controls.Image;
Import mx.controls.dataGridClasses.DataGridListData;
Import mx.controls.listClasses.BaseListData;
Import mx.controls.listClasses.IDropInListItemRenderer;
Import mx.controls.listClasses.IListItemRenderer;
Import mx.core.IDataRenderer;
Import mx.core.IFlexDisplayObject;
Import mx.core.IToolTip;
Import mx.core.SpriteAsset;
Import mx.core.UIComponent;
Import mx.core.UITextField;
Import mx.events.FlexEvent;
Import mx.events.ToolTipEvent;
Import mx.events.TreeEvent;
Import mx.managers.ILayoutManagerClient;
Import mx.styles.IStyleClient;
SerializableAttribute public class TreeGridItemRenderer extends UIComponent
implements IDataRenderer,
IDropInListItemRenderer,
ILayoutManagerClient,
IListItemRenderer
{...Any help would be great!
It's because you put your component in a box. The DataGrid control is affecting .data property of the box and without code is on your component. You shouldn't really need box. You can override updateDisplayList to Center your button instead.
Alex Harui
Flex SDK Developer
Adobe Systems Inc..
-
How to use the TRUNC function with dates in the expression builder in OBIEE.
Hello
How to use the TRUNC function with dates in the expression builder in OBIEE.
TRUNC (SYSDATE, 'MM') returns 1 July 2010"where sysdate is July 15, 2010 ' in SQL. I need to use the same in the expression builder in the logical layer mdb column.
Thanks in advanceUse it instead:
TIMESTAMPADD (SQL_TSI_DAY, (DAYOFMONTH (CURRENT_DATE) *-1) + 1, CURRENT_DATE) -
PL/SQL FUNCTION: Passage date &; string as parameter
Hello
I have a situation where I have to convert the ISO date format Date [YYYY-MM - DDTHH24:MI]
Is function def. : FN_ISO (IN_DATE Varchar2, Varchar2 IN_TIME)
Front-end for the date and time, I can enter in 3 different ways.
Input 1. what date / time is completely known
Date: 5 April 2015
Time: 23:56
Input 2. When the date is known, but the time is unclear (the hour is UNK)
Date: 5 April 2015
Time: UNK:56
Entry 3. When the date and time are unknown (month is UNK)
Date: 05-UNK-2015
Time: UNK:56
Here, I am facing the problem with the Time parameter. Please find below scenarios:
Scenario 1: If the time is complete (as input 1) then I'll pass the data type Date in 2nd parameter (5 April 2015, which contains the time internally)
Scenario 2: If the time is incomplete or partially known (as input 2) then I'll pass the Varchar2 data type in 2nd parameter (UNK:56 as string)
Problem statement:
Consider scenario 1; If date & time is over so I'm passing the data type Date (April 5, 2015 23:56) Varchar2, then time will be 5 April 2015 00:00, however I need to get the time (23:56)
Note:
-I can't use the overload of functions.
-I can not change the way call function which I now call.
-I can't do second parameter date because in scenario 2 I have to pass the string "UNK:56".
Please suggest me, how I can address the issue. Your help would be very appreciated.
Thanks in advance!
create or replace function fun_iso (IN_DATE VARCHAR, IN_TIME VARCHAR2 ) return varchar2 is V_ISO varchar2(20); begin SELECT (case when regexp_like(IN_DATE,'(UNK|\d+)/(UNK|\d+)/(UNK|\d+)') THEN REGEXP_REPLACE((REGEXP_REPLACE(translate(in_date||' '||in_time,'/ ','-T'),'UNK|NUL','-')),'(:|-|T)+$') WHEN regexp_like(IN_DATE,'\d+-(\w+|\d+)-(\d+)') then REGEXP_REPLACE((REGEXP_REPLACE(translate(TO_char(to_date(IN_DATE,'DD-MM-YY'),'YYYY-MM-DD')||' '|| /*for scenario 1*/ (CASE WHEN regexp_like(IN_TIME,'(\d+)-(\w+)-(\d+)') THEN DECODE(TO_CHAR((IN_TIME),'HH24:MI:SS'),'00:00:00', NULL,TO_CHAR(IN_TIME,'HH24:MI:SS')) /* Here i need time if i will pass 05-Apr-2015*/ ELSE NULL END) ,'/ ','-T'),'UNK|NUL','-')),'(:|-|T)+$') else '0' END) INTO V_ISO from dual; RETURN V_ISO; end; / /* Use below table : line 35 is scenario 1 */ select a.*, fun_iso(IN_DATE, IN_TIME) FROM ( (SELECT '2015-01-15T22:29:59 ' ISO_DATE_TIME, '2015/05/05' IN_DATE , '22:29:59' IN_TIME FROM DUAL UNION SELECT ' ' ISO_DATE_TIME, 'UNK/UNK/UNK' IN_DATE , '22:29:NUL' IN_TIME FROM DUAL UNION SELECT ' ' ISO_DATE_TIME, '01-Jan-15' IN_DATE , '22:UNK:NUL' IN_TIME FROM DUAL UNION SELECT ' ' ISO_DATE_TIME, '01-Jan-1948' IN_DATE , '22:29:NUL' IN_TIME FROM DUAL UNION SELECT ' ' ISO_DATE_TIME, '01-05-15' IN_DATE , '22:29:NUL' IN_TIME FROM DUAL UNION SELECT ' ' ISO_DATE_TIME, '25-05-2015' IN_DATE , '22:29:NUL' IN_TIME FROM DUAL UNION --SELECT ' ' ISO_DATE_TIME, '25-05-2015' IN_DATE , TO_CHAR(TO_DATE('01-AUG-14 23:56:00','DD-Mon-YY HH24:MI:SS')) IN_TIME FROM DUAL UNION SELECT '2009' ISO_DATE_TIME, '2009/UNK/UNK' IN_DATE , 'UNK:UNK:NUL' IN_TIME FROM DUAL UNION SELECT '2009---25' ISO_DATE_TIME, '2009/UNK/25' IN_DATE , 'UNK:UNK:NUL' IN_TIME FROM DUAL UNION SELECT '--03-25' ISO_DATE_TIME, 'UNK/03/25' IN_DATE , 'UNK:UNK:NUL' IN_TIME FROM DUAL UNION SELECT '--03--T-:15' ISO_DATE_TIME, 'UNK/03/UNK' IN_DATE , 'UNK:15:NUL' IN_TIME FROM DUAL UNION SELECT '2009-03 ' ISO_DATE_TIME, '2009/03/UNK' IN_DATE , 'UNK:UNK:NUL' IN_TIME FROM DUAL UNION SELECT '2009-03--T12' ISO_DATE_TIME, '2009/03/UNK' IN_DATE , '12:UNK:NUL' IN_TIME FROM DUAL ) ) a;
Hello
Here's one way:
FUNCTION to CREATE or REPLACE fun_iso
(in_date in VARCHAR2
in_time IN VARCHAR2
)
RETURN VARCHAR2
DETERMINISTIC
IS
month_name VARCHAR2 (51): = ' JAN Feb MAR Apr MAY June July Aug SEP OCT NOV DEC UNK;
month_num VARCHAR2 (50): = '01 02 03 04 05 06 07 08 09 10 11 12-';
BEGIN
RETURN SUBSTR (in_date,-4)
|| '-'
|| SUBSTR (month_num
INSTR (month_name
, SUBSTR (in_date, 4, 3)
)
2
)
|| '-'
|| SUBSTR (in_date, 1, 2)
|| ' T '
|| CASE
WHEN SUBSTR (in_time, 1, 3) = "UNK".
THEN '-'
Of OTHER SUBSTR (in_time, 1, 2)
END
|| '-'
|| SUBSTR (in_time-2)
;
END fun_iso;
/
If your needs are more complex, you can do this drill several assignments, where you build a string a little at a time, and RETURN this string at the end.
-
Hai all
10.2.0.5 on solaris 10
I use the query to retrieve the data files created with tablespace name below
output isselect a.creation_time,b.tablespace_name from v$datafile a,dba_data_files b where b.file_id=a.file# order by a.creation_time desc;
Now, I need an application to retrieve the number of data files created on tablespaces4/7/2013 10:13:42 AM TS_IMSI_IMEI_COUNTER03 4/7/2013 10:11:56 AM TS_IMSI_IMEI_COUNTER03 4/7/2013 10:10:14 AM TS_RATED_GPRS_CDR14
for the past 6 months, in such a way that the output is as below:
Can someone guide meMonth No of datafiles tablespacename Mar2013 4 system
Hello
Here's one way:
SELECT TO_CHAR ( TRUNC (v.creation_time, 'MONTH') , 'Mon YYYY' ) AS month , COUNT (*) AS no_of_datafiles , d.tablespace_name FROM v$datafile v , dba_data_files d WHERE d.file_id = v.file# GROUP BY TRUNC (v.creation_time, 'MONTH') , d.tablespace_name ORDER BY TRUNC (v.creation_time, 'MONTH') DESC , d.tablespace_name ;
TRUNC allows to map all creation_times to once a month.
Use the COUNT aggregation function to get the number of files.
Using an aggregate function means that you will have to GROUP BY, the month and the tablespace. -
function with dates to compare?
Hi all
in my test examples, which must extend, problem start by employees who start working
previous year (2014, 2013...) more months then sys - 10 month and day to start working more then 28 large
all other dates are working fine.
At this point I've seen like this:
SELECT SUM ((extrait (an (SYSDATE))-extract (year DATE_OF_BEGIN_WORK))) as the year.
SUM (abs (extract(month from SYSDATE)-extract(month from DATE_OF_BEGIN_WORK))) as month,
SUM (abs (extract(day from SYSDATE)-extract(day from DATE_OF_BEGIN_WORK))) as day, group employ_id employ_id table_a where active = 1
are there solutions for creating features that compare the dates in the table:
table_a have colum DATE_OF_BEGIN_WORK compare with sysdate
case 1:
months from the date of start to work > sysdate current months and days of the date to start work > current sysdate day and date of start working < sysdate year then
(extract (YEAR sysdate)-extract (YEAR DATE_OF_BEGIN_WORK));
(Excerpt extracted from (DATE_OF_BEGIN_WORK months) - (sysdate month));
(extract (DATE_OF_BEGIN_WORK days) - excerpt (sysdate days));
case 2:
months from the date of starting work < sysdate current months and the days of the date to start work < current sysdate day and date of start working < sysdate year then
(extract (YEAR sysdate)-extract (YEAR DATE_OF_BEGIN_WORK));
((sysdate sysdate months) extract - extract (DATE_OF_BEGIN_WORK month));
((sysdate day) extract - extract (DATE_OF_BEGIN_WORK days)) + 1;
case 3:
months from the date of start to work > sysdate current months and days of the date to start work > current sysdate day and date of start working < sysdate year then
(extract (YEAR sysdate)-extract (YEAR DATE_OF_BEGIN_WORK))-1;
((extract(month from DATE_OF_BEGIN_WORK)-12) - extract (DATE_OF_BEGIN_WORK month));
(extract (DATE_OF_BEGIN_WORK days) - EXTRACTED (LAST_DAY DATE (DATE_OF_BEGIN_WORK)) + extract (sysdate days)) + 1;
no idea how to solve this problem with the functions will be very useful
concerning
Gordan
It seems you are trying to re - invent most of date mathematics that Oracle has obtained already integrated into it. You'll just put in trouble, especially when there are leap years etc.
How about something like this?
SQL > with (id, dt) t (select 1, to_date('02/06/2010','MM/DD/YYYY') of all the double union)
2 Select 2, to_date('11/29/2001','MM/DD/YYYY') of all the double union
3 select 3, to_date('02/06/2011','MM/DD/YYYY') of all the double union
4. Select option 4, double to_date('10/10/2011','MM/DD/YYYY')
5 )
6 --
7. end of test data
8 --
9 select id, dt
10, floor (months_between(sysdate,dt)/12) years
11, floor (mod (months_between (sysdate, dt), 12)) months
12 - day be ambiguous because of the number of days in a different month
13. you could design your own algorithm to give the desired results, but it is a good approximation
14, floor (sysdate-(add_months (dt, floor (months_between (sysdate, dt))) as dys
15 t
16.
ID DT YEARS MONTHS DYS
---------- ----------- ---------- ---------- ----------
1-6 FEBRUARY 2010 5 8 22
2 29 NOVEMBER 2001 13 10 29
3-6 FEBRUARY 2011 4 8 22
4-10 OCTOBER 2011 4 0 184 selected lines.
-
doubt, querying with dates
Hi all, I have a doubt, a sql statement that includes the date of the interrogation.
Now the date of passage1 SELECT rsh.shipment_num "File#" 2 ,mmt.transaction_date "Transaction Date" 3 FROM rcv_shipment_headers rsh, 4 ap_suppliers aps, 5 po_headers_all pha, 6 po_lines_all pla, 7 mtl_system_items_kfv msi, 8 rcv_shipment_lines rsl, 9 rcv_transactions rcv, 10 mtl_material_transactions mmt, 11 mtl_transaction_types mtt 12 WHERE rsh.vendor_id = aps.vendor_id 13 AND pha.po_header_id = pla.po_header_id 14 AND pla.item_id = msi.inventory_item_id 15 AND pha.po_header_id = rsl.po_header_id 16 and pla.po_line_id = rsl.po_line_id 17 AND rsl.shipment_header_id = rsh.shipment_header_id 18 AND rsl.item_id = msi.inventory_item_id 19 AND rsl.to_organization_id = msi.organization_id 20 AND rcv.shipment_header_id = rsh.shipment_header_id 21 AND rcv.organization_id = msi.organization_id 22 AND rcv.po_header_id = pha.po_header_id 23 AND rcv.po_line_id = pla.po_line_id 24 --and pla.org_id = msi.organization_id 25 AND rsh.SHIPMENT_NUM = 'AP1005' 26 --AND mmt.transaction_date = TO_CHAR(TO_DATE('14-SEP-2012','DD-MON-YYYY')) 27 AND rcv.transaction_type = 'DELIVER' 28 AND rcv.source_document_code = 'PO' 29 --AND rcv.subinventory = 'Vessel' 30 AND mmt.rcv_transaction_id = rcv.transaction_id 31 AND mmt.transaction_type_id = mtt.transaction_type_id 32* AND rcv.organization_id = 81 SQL> / File# Transacti ------------------------------ --------- AP1005 14-SEP-12 AP1005 14-SEP-12
Can someone pls suggest me where I am doing wrong.1 SELECT rsh.shipment_num "File#" 2 ,mmt.transaction_date "Transaction Date" 3 FROM rcv_shipment_headers rsh, 4 ap_suppliers aps, 5 po_headers_all pha, 6 po_lines_all pla, 7 mtl_system_items_kfv msi, 8 rcv_shipment_lines rsl, 9 rcv_transactions rcv, 10 mtl_material_transactions mmt, 11 mtl_transaction_types mtt 12 WHERE rsh.vendor_id = aps.vendor_id 13 AND pha.po_header_id = pla.po_header_id 14 AND pla.item_id = msi.inventory_item_id 15 AND pha.po_header_id = rsl.po_header_id 16 and pla.po_line_id = rsl.po_line_id 17 AND rsl.shipment_header_id = rsh.shipment_header_id 18 AND rsl.item_id = msi.inventory_item_id 19 AND rsl.to_organization_id = msi.organization_id 20 AND rcv.shipment_header_id = rsh.shipment_header_id 21 AND rcv.organization_id = msi.organization_id 22 AND rcv.po_header_id = pha.po_header_id 23 AND rcv.po_line_id = pla.po_line_id 24 --and pla.org_id = msi.organization_id 25 --AND rsh.SHIPMENT_NUM = 'AP1005' 26 AND mmt.transaction_date = TO_CHAR(TO_DATE('14-SEP-2012','DD-MON-YYYY')) 27 AND rcv.transaction_type = 'DELIVER' 28 AND rcv.source_document_code = 'PO' 29 --AND rcv.subinventory = 'Vessel' 30 AND mmt.rcv_transaction_id = rcv.transaction_id 31 AND mmt.transaction_type_id = mtt.transaction_type_id 32* AND rcv.organization_id = 81 SQL> / no rows selected
Any help is appreciated,
Thanks in advanceYou can try the below
AND trunc(mmt.transaction_date) = TO_DATE('14-SEP-2012','DD-MON-YYYY')
I hope that your column is DATE data type. You need not use to_char. When you use a STRING comparison will happen.
More on the date of your field is assigned a part of the TIME. You must trucate the time part.
Or if you plan to use the index on the DATE column, you can write it as
AND mmt.transaction_date between TO_DATE('14-SEP-2012','DD-MON-YYYY') and TO_DATE('14-SEP-2012 23:59:59','DD-MON-YYYY hh24:mi:ss') Edited by: jeneesh on Sep 14, 2012 5:19 PM
-
Problem with analytical function for date
Hi all
ORCL worm:
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production."
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I have a problem with the analtical for the date function. I'm trying to group records based on timestamp, but I'm failing to do.
Could you please help me find where I'm missing.
THXThis is the subquery. No issue with this. I'm just posting it for reference. select sum(disclosed_cost_allocation.to_be_paid_amt) amt, substr(reference_data.ref_code,4,10) cd, to_char(external_order_status.status_updated_tmstp, 'DD-MON-YYYY HH24:MI:SS') tmstp, DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID id FROM Deal.Fee_Mapping_Definition , Deal.Fee_Index_Definition , Deal.Fee_Closing_Cost_Item, Deal.Closing_Cost, Deal.Document_Generation_Request, deal.PRODUCT_REQUEST, deal.External_Order_Request, deal.External_Order_Status, deal. DISCLOSED_CLOSING_COST, deal.DISCLOSED_COST_ALLOCATION, deal.reference_data WHERE Fee_Mapping_Definition.Fee_Code = Fee_Index_Definition.Fee_Code AND Fee_Index_Definition.Fee_Index_Definition_Id = Fee_Closing_Cost_Item.Fee_Index_Definition_Id AND Fee_Closing_Cost_Item.Closing_Cost_Id = Closing_Cost.Closing_Cost_Id AND CLOSING_COST.PRODUCT_REQUEST_ID = Document_Generation_Request.Product_Request_Id AND closing_cost.product_request_id = product_request.product_request_id AND Product_Request.Deal_Id = External_Order_Request.Deal_Id AND external_order_request.external_order_request_id = external_order_status.external_order_request_id AND external_order_request.external_order_request_id = disclosed_closing_cost.external_order_request_id AND DISCLOSED_CLOSING_COST. DISCLOSED_CLOSING_COST_ID = DISCLOSED_COST_ALLOCATION.DISCLOSED_CLOSING_COST_ID AND Fee_Index_Definition.Fee_Index_Definition_Id = Disclosed_Closing_Cost.Fee_Index_Definition_Id AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id = Reference_Data.Reference_Data_Id AND Document_Generation_Request.Document_Package_Ref_Id IN (7392 ,2209 ) AND External_Order_Status.Order_Status_Txt = ('GenerationCompleted') AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id IN ( 7789, 7788,7596 ) AND FEE_MAPPING_DEFINITION.DOCUMENT_TYPE_REF_ID = 1099 AND Document_Generation_Request.Product_Request_Id IN (SELECT PRODUCT_REQUEST.PRODUCT_REQUEST_id FROM Deal.Disclosed_Cost_Allocation, Deal.Disclosed_Closing_Cost, DEAL.External_Order_Request, DEAL.PRODUCT_REQUEST, Deal.Scenario WHERE Disclosed_Cost_Allocation.Disclosed_Closing_Cost_Id = Disclosed_Closing_Cost.Disclosed_Closing_Cost_Id AND Disclosed_Closing_Cost.External_Order_Request_Id = External_Order_Request.External_Order_Request_Id AND External_Order_Request.Deal_Id = Product_Request.Deal_Id AND product_request.scenario_id = scenario.scenario_id AND SCENARIO.SCENARIO_STATUS_TYPE_REF_ID = 7206 AND product_request.servicing_loan_acct_num IS NOT NULL AND product_request.servicing_loan_acct_num = 0017498379 --AND Disclosed_Cost_Allocation.Disclosed_Cost_Allocation_Id = 5095263 ) GROUP BY DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID, External_Order_Status.Status_Updated_Tmstp, Reference_Data.Ref_Code, disclosed_cost_allocation.to_be_paid_amt order by 3 desc, 1 DESC; Result: 2000 1304-1399 28-JUL-2012 19:49:47 6880959 312 1302 28-JUL-2012 19:49:47 6880958 76 1303 28-JUL-2012 19:49:47 6880957 2000 1304-1399 28-JUL-2012 18:02:16 6880539 312 1302 28-JUL-2012 18:02:16 6880538 76 1303 28-JUL-2012 18:02:16 6880537 But, when I try to group the timestamp using analytical function, select amt ,cd ,rank() over(partition by tmstp order by tmstp desc) rn from (select sum(disclosed_cost_allocation.to_be_paid_amt) amt, substr(reference_data.ref_code,4,10) cd, to_char(external_order_status.status_updated_tmstp, 'DD-MON-YYYY HH24:MI:SS') tmstp, DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID id FROM Deal.Fee_Mapping_Definition , Deal.Fee_Index_Definition , Deal.Fee_Closing_Cost_Item, Deal.Closing_Cost, Deal.Document_Generation_Request, deal.PRODUCT_REQUEST, deal.External_Order_Request, deal.External_Order_Status, deal. DISCLOSED_CLOSING_COST, deal.DISCLOSED_COST_ALLOCATION, deal.reference_data WHERE Fee_Mapping_Definition.Fee_Code = Fee_Index_Definition.Fee_Code AND Fee_Index_Definition.Fee_Index_Definition_Id = Fee_Closing_Cost_Item.Fee_Index_Definition_Id AND Fee_Closing_Cost_Item.Closing_Cost_Id = Closing_Cost.Closing_Cost_Id AND CLOSING_COST.PRODUCT_REQUEST_ID = Document_Generation_Request.Product_Request_Id AND closing_cost.product_request_id = product_request.product_request_id AND Product_Request.Deal_Id = External_Order_Request.Deal_Id AND external_order_request.external_order_request_id = external_order_status.external_order_request_id AND external_order_request.external_order_request_id = disclosed_closing_cost.external_order_request_id AND DISCLOSED_CLOSING_COST. DISCLOSED_CLOSING_COST_ID = DISCLOSED_COST_ALLOCATION.DISCLOSED_CLOSING_COST_ID AND Fee_Index_Definition.Fee_Index_Definition_Id = Disclosed_Closing_Cost.Fee_Index_Definition_Id AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id = Reference_Data.Reference_Data_Id AND Document_Generation_Request.Document_Package_Ref_Id IN (7392 ,2209 ) AND External_Order_Status.Order_Status_Txt = ('GenerationCompleted') AND Fee_Mapping_Definition.Document_Line_Series_Ref_Id IN ( 7789, 7788,7596 ) AND FEE_MAPPING_DEFINITION.DOCUMENT_TYPE_REF_ID = 1099 AND Document_Generation_Request.Product_Request_Id IN (SELECT PRODUCT_REQUEST.PRODUCT_REQUEST_id FROM Deal.Disclosed_Cost_Allocation, Deal.Disclosed_Closing_Cost, DEAL.External_Order_Request, DEAL.PRODUCT_REQUEST, Deal.Scenario WHERE Disclosed_Cost_Allocation.Disclosed_Closing_Cost_Id = Disclosed_Closing_Cost.Disclosed_Closing_Cost_Id AND Disclosed_Closing_Cost.External_Order_Request_Id = External_Order_Request.External_Order_Request_Id AND External_Order_Request.Deal_Id = Product_Request.Deal_Id AND product_request.scenario_id = scenario.scenario_id AND SCENARIO.SCENARIO_STATUS_TYPE_REF_ID = 7206 AND product_request.servicing_loan_acct_num IS NOT NULL AND product_request.servicing_loan_acct_num = 0017498379 --AND Disclosed_Cost_Allocation.Disclosed_Cost_Allocation_Id = 5095263 ) GROUP BY DISCLOSED_CLOSING_COST.DISCLOSED_CLOSING_COST_ID, External_Order_Status.Status_Updated_Tmstp, Reference_Data.Ref_Code, disclosed_cost_allocation.to_be_paid_amt order by 3 desc, 1 DESC); Result: 312 1302 1 2000 1304-1399 1 76 1303 1 312 1302 1 2000 1304-1399 1 76 1303 1 Required output: 312 1302 1 2000 1304-1399 1 76 1303 1 312 1302 2 2000 1304-1399 2 76 1303 2
Rod.Hey, Rod,
My guess is that you want:
, dense_rank () over (order by tmstp desc) AS rn
RANK means you'll jump numbers when there is a link. For example, if all 3 rows have the exact same last tmstp, all 3 rows would be assigned number 1, GRADE would assign 4 to the next line, but DENSE_RANK attributes 2.
"PARTITION x" means that you are looking for a separate series of numbers (starting with 1) for each value of x. If you want just a series of numbers for the entire result set, then do not use a PARTITION BY clause at all. (PARTITION BY is never required.)
Maybe you want to PARTITIONNER IN cd. I can't do it without some examples of data, as well as an explanation of why you want the results of these data.
You certainly don't want to PARTITION you BY the same expression ORDER BY; It simply means that all the lines are tied for #1.I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
Simplify the problem as much as possible.
Always tell what version of Oracle you are using.
See the FAQ forum {message identifier: = 9360002}Published by: Frank Kulash, August 1, 2012 13:20
-
Hello:
Some explain what are the functional differences and source of data between W_GL_BALANCE_F and W_GL_OTHER_F? The two seem to group by GROUP_ACCOUNT_NUM.
Thank you.It is not possible; all transactions in GL other eventually GL balance.
Both tables have essentially the same data but different grains. Two main differences:-Other GL have transaction log; GL balance make them summarized at the account level.
-Other GL is really additive since its transactions of individual entries. that is, you can just sum() any number of transactions and double counting used a trx; Balance of GL is a table of monthly snapshot. that is, it provides account balance for all accounts for the end of each month, so you can never add two snapshots. -
year of data month interval tape question
Mr President
I'm new to all aspects of Database.I getting ready for 051. but I need assistance helps dispel a doubt on year interval to the months of doubt data types.
next insert statement:create table time_example2 ( loan_duration INTERVAL YEAR (3) TO MONTH );
AS I am specifying the size create statement why I need to specify the size of the MONTH in the insert statement.INSERT INTO time_example2 (loan_duration) VALUES (INTERVAL '120' MONTH(3) );
Interesting, I didn't realize, you can specify the precision for YTM interval literals but it seems [you can | http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements003.htm#sthref362], and
INTERVAL '3' MONTH(3)
is equivalent to
INTERVAL '0-3' YEAR(3) TO MONTH
Why anyone would use every month, I don't know, but it's there.
Maybe you are looking for
-
Every once in a while my Firefox icon and cursor start to Flash - why?
I have no further details
-
Re: TEAC DVD Player/Recorder has stopped working in my Satellite A200
Help TEAC CD/DVD drive no longer works, says the pilot is maybe damaged.I tried all updates etc still does not. Can anyone help?
-
Having a program that keeps coming back. How can I find; It does not show in programs, click Add/Remove. Also, I can delet not the icon at the bottom right of the screen where the clock is. What I'm doing. Thank you
-
Hello The printer is supplied with the current, but the display is not illuminated. The printer is not adjusted itself. You cannot use all the utilities. Best regards Friedrich
-
Headphone Sound quality soundproof with no. beat all of a sudden
Hi, a few days ago, I started my laptop (Toshiba C855) to listen to music through my headphones (which I do every day), and the sound quality was terrible, really choked with no background of graves and so bad, I couldn't distinguish the songs that w