TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY')
Hi all,
I am working with a Oracle 9i R2 database
SQL>select TO_CHAR(sysdate, 'MM/DD/YYYY') CHRDATE from dual;
CHRDATE
11/14/2005
SQL>select TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY') mydate from dual;
MYDATE
14-NOV-05
I want to retain the 4 digit year. Please suggest what I am doing incorrect.
Thanks
Your select statement,SQL>select TO_DATE(TO_CHAR(sysdate,...is equivalent toselect sysdate...And whenever you select a date, SQL Plus has to convert it to a character format before it can display it on the SQL Plus output screen.
The four-digit year IS being retained internally ...until you display it on the screen. If you just set the default date format for displaying dates to include the four-digit year, you will see the full year:
SQL> select SYSDATE mydate from dual;
MYDATE
14-NOV-05
SQL> alter session set nls_date_format = 'MM/DD/YYYY';
SQL> select SYSDATE mydate from dual;
MYDATE
11/14/2005
SQL> select TO_DATE(TO_CHAR(sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY') mydate from dual;
MYDATE
11/14/2005
Similar Messages
-
Hi
I am using this conversion to_date(to_char(sysdate,'dd/mm/yyyy hh24:mm'),'dd/mm/yyyy hh24:mm')
but it says format string appears twice
Could some one please help me with this?user11365275 wrote:
I have a requirement for taking hh:mi from a date ..ie i need to compare two dates till hrs and mins level but not secs..so i was trying to take the date till hrs,mins and then convert to dates and compare them...Exactly this is my requirement
to_date(TO_CHAR(LOAD_DATE,'DD/MM/YYYY HH24:Mi'),'DD/MM/YYYY HH24:Mi')
<(SELECT to_date(TO_CHAR(CURRLOADTIME,'DD/MM/YYYY HH24:Mi'),'DD/MM/YYYY HH24:Mi')
FROM Table1 WHERE
JOBNAME='DEFAULT_EVENT_LOG');
PLease can you suggest anything better than this comparison or let me know if this works correct nowYou are using a TO_CHAR to format a date field in a string. Then use a TO_DATE to change it back to a date. This "double" formatting is a deep misunderstanding about what is a date field.
If you want to compare dates and get rid of the seconds, use truncate, for instance :
SQL> select trunc(sysdate,'mi'),sysdate from dual;
TRUNC(SYSDATE,'MI') SYSDATE
02/02/2010 09:18:00 02/02/2010 09:18:55Your WHERE clause will become :
...trunc(LOAD_DATE,'mi')<(SELECT trunc(CURRLOADTIME,'mi')...Nicolas. -
What is the difference between storing sysdate or to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') in a date data type column?
When I column value is set with sysdate the following query gives no records
select *
from Test
WHERE Updatedon = to_date('22 Sep 2012 07:55 PM','DD Mon YYYY HH:MI AM');
when I run the same query with out where clause I am getting the records with that time or storing with to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') gives records.
Can someone explain the difference please?Hi,
Welcome to the forum!
user8765044 wrote:
What is the difference between storing sysdate or to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') in a date data type column?Remember that all DATEs include hours, minutes and seconds , as well as year, month and day.
to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM')is equivalent to
TRUNC (SYSDATE, 'MI')To see why, consider what
to_char(sysdate, 'DD Mon YYYY HH:MI AM'),does. It creates a string out of the year, month, day, hours and minutes of SYSDATE, but it ignores the seconds. If you convert that string into a DATE, the seconds will default to 00.
When I column value is set with sysdate the following query gives no records
select *
from Test
WHERE Updatedon = to_date('22 Sep 2012 07:55 PM','DD Mon YYYY HH:MI AM');
when I run the same query with out where clause I am getting the records with that time or storing with to_date(to_char(sysdate, 'DD Mon YYYY HH:MI AM'),'DD Mon YYYY HH:MI AM') gives records.Whenever you get confusing results with DATEs, display the full DATE, including hours, minutes and seconds.
To change the default DATE format in your session, so that the hours, minutes and seconds appear automatically, use ALTER SESSION. For example:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-Mon-YYYY HH:MI:SS AM'; -
How to convert sysdate to the format dd-mon-yyyy
how to convert sysdate to the format dd-mon-yyyy
<how to convert sysdate to the format dd-mon-yyyy>
This question is better answered by thinking about about how Oracle dates work. SYSDATE is a pseudocolumn (function without any arguments) that returns a date value: it already is a date. Oracle date values are stored not as we see them, say 'DD-MON-YY', but as a series of bytes with the different date components from the millennium down to the second. We NEVER see dates as they are stored but use the formats for automatic conversion.
To display a date the way you want use TO_CHAR() with an edit mask or as others suggested change your NLS_DATE_FORMAT (thought I advise against this as most systems use DD-MON-YY and porting queries from other systems or even OTN can easily break). To change a converted string back to a date use TO_DATE() with an edit mask. -
How can I remove blank space after month value while selecting to_char(sysdate)
select to_char(sysdate,'dd-month-yyyy') from dual;
when I give this query, I'm getting a blank space after the month value. How can I trim that?Or else try this one
select to_char(sysdate,'dd-fmmonth-yyyy') from dual;
Best of luck. -
What is the use of To_date, to_char functions?
what is the use of To_date, to_char functions?
while i am using these in my day to day activities but never able to know the exact working of tehse.
Message was edited by:
437022Dates are stored and manipulated as coded (binary) values that always contain "century, year, month, date, hour, minute second"
We don't want to see the date as stored. We want to see the characters (digits) that make up the date. So we use to_char(the-date-value)
We want to tell the system a date, but have a heck of a time entering the binary. So we input the characters (digits) that make up the date and tell the system to convert that to a binary 'date' using to_date(our-string-that-respresents-dates)
The magic Oracle has added is the format codes (see chapter 2 of the SQL Reference manual for the complete list). We can get the system to print out dates and times, including day of week (and so on) using format codes.
The default format is to show us the date but not the time. Which leads a lot of people to believe that the time is not stored. -
I want to change the date format MM/YYYY to MM.YYYY in web report
Hi to all experts,
Here the problem is: when i run a report for variable input when we select date as MM/YYYY its getting error . Here i need to change MM/YYYY to MM.YYYY. can u please tell me where exactly i need to change means in BEx or Web? if it is BEx where it is exactly pls tell m ethe step to step procedure.
Its urgent!
( I will assign the points if its useful to me)
Advance Thanks,
ShahHi Siggi,
In su01 if we go and change the date format from MM/YYYY to MM.YYYY for a particular user ex:ss11 , if another user ex:bst55 try to run the web report he/she may get same error .If we make the change in su01-> default tab->under date format for a particular user , is it work for other users?
Can u tell me step by step where exactly we need to go in AWB and where need to modify.
I am looking for ur answer.
Thanks in Advance
Shah -
To_date,to_char function behavior
I have a table that contains starting dates of employment for employees. Since the table could have several starting dates (This is normal in our institution), I wrote a pl/sql loop to count the number of employees whose ONLY starting date (meaning they have only one starting date) lies in the year 2008. Now I faced the following problems when running the code in a when-button-pressed trigger in forms:
1. the counter in the statement
if to_char(docexecdt,'dd-mm-yyyy) between '1-1-2008' and '31-12-2008' then x:=x+1
returned an abnormal number (too large for the size of the table)
(where docexecdt is the field containing the starting date)
is using to_char here incorrect?
2. the statement
if to_date(docexecdt) between '1-1-2008' and '31-12-2008' then x:=x+1
returned an error "invalid month"
although I tried several date formats.
given that I tried running the same to_date function on the table in sql*plus with no error returned.
What is the correct format mask for the to_date function?-> Why does the to_char(docexecdt,'dd-mm-yyyy') return an incorrect result?
Because putting dd (the day of the month) first puts EVERY day between your dates:
01-01-2008 is LESS than ALL the following dates:
01-02-1982
12-01-2000
15-08-1998
30-01-2009
30-12-2020
31-12-2008 is GREATER than ALL the above dates.
NEVER compare dates by placing DAY or MONTH before the year!!!!
When you compare using DDMMYYYY format, the only dates less than 01-01-2008 are January 1 of any prior year. The only dates greater than 31-12-2008 are 31-December of any year greater than 2008.
The correct way to find your count is given by Paul M, where you ONLY look at the year. -
Usage of to_date & to_char
pls. give advanced usage of to_date & to_char
pls. give advanced usage of to_date & to_charTO_DATE
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions137a.htm
TO_CHAR
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions134a.htm#1009326
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions133a.htm#1003490
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions135a.htm#79332 -
BEX: Changing date format from 'mm/dd/yyyy' to 'mon/yyyy'
Happy Friday! I need to change the date format in my BEX query from a regular date format (dd/mm/yyyy) to display as 'JUN/2008'. Please note that I dont want to modify the date field but just need to display it month and year format in the bex query. Would truly appreciate a complete answer.
ThanksHi
Check the first thread
Hope this will solve your problem.
How to change Date format in Bex to DD/MM/YYYY
Check ur Windows or Excel settings. Try changing it in Control Panel->Regional Options->Date->Short Date format.
change it in Control Panel->Regional Options->Date->Short Date format.
Changing Date format in BEx & Web Application
I Need to change Date Format in BEx report
Regards
M.A
Edited by: M.A on Jun 27, 2008 10:12 PM -
SSIS Convert DD MON YYYY -- DD/MM/YYYY
Hi guys trying to convert
16JAN2014 --> 16/01/2014. Any ideas??? i'm trying to avoid the horrendous expression of ? JAN : 1 ? FEB : 2 etc. etc.
SSMS will quite happily do SELECT MONTH('16JAN2014') to get me the number of month however MONTH( "16JAN2014" ) will not work in SSIS.Why not bring it as string in format 1 JAN 2014 and insert to sql table with datetime type? It will accept values in the format and would automatically convert it to correct date value which will be displayed as 2014-01-01 00:00:00
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Getting result for current date
Hi,
I have a problem on getting the following result
CO_ID RECEIVE SHIP_OUT ONHAND OPENING DATE GR_ID COMPONENT_NAME
100 0 0 9 9 24-JUN-09 234 Paper
200 8 0 8 0 25-JUN-09 123 Plastic Bag
100 10 0 19 9 25-JUN-09 234 Paper
200 0 0 8 8 26-JUN-09 123 Plastic Bag
100 0 0 19 19 26-JUN-09 234 Paperwith this, it doesn't add a new result on tomorrow record, and today record also not correct. Help me pls....
PROCEDURE Inv_Rec IS
dToDate DATE := TO_DATE(SYSDATE, 'DD-MON-YY');
dLoopDay DATE := TO_DATE(SYSDATE - 1, 'DD-MON-YY');
rDayBeforeInvRec Inventory%ROWTYPE;
rInDateInvRec Inventory%ROWTYPE;
fInDateOnHandQty FLOAT;
fInDateOpeningQty FLOAT;
fBForeDateOpeningQty FLOAT;
fBForeDateOnHandQty FLOAT;
nComponentId NUMBER(25);
vCompDept VARCHAR2(20);
vCompName VARCHAR2(80);
vWasteType VARCHAR2(2);
nGroupId NUMBER(25);
vComponentName VARCHAR2(80);
CURSOR Day_Before_Inv_Bal IS
SELECT * FROM inventory
WHERE date = dLoopDay;
CURSOR InDate_Rec_Exist IS
SELECT * FROM inventory
WHERE date = dToDate
AND co_id = nComponentId
AND gr_id = nGroupId
AND component_name = vComponentName;
BEGIN
WHILE dLoopDay <= dToDate + 1
LOOP
OPEN Day_Before_Inv_Bal;
LOOP
FETCH Day_Before_Inv_Bal INTO rDayBeforeInvRec;
nComponentId := rDayBeforeInvRec.co_id;
nGroupId := rDayBeforeInvRec.gr_id;
vComponentName := rDayBeforeInvRec.component_name;
fBForeDateOnHandQty := rDayBeforeInvRec.opening +
rDayBeforeInvRec.receive - rDayBeforeInvRec.ship_out;
UPDATE inventory SET
ONHAND = fBForeDateOnHandQty
WHERE date = dLoopDay
AND co_id = nComponentId
AND gr_id = nGroupId
AND component_name = vComponentName;
OPEN InDate_Rec_Exist;
FETCH InDate_Rec_Exist INTO rInDateInvRec;
IF InDate_Rec_Exist%FOUND THEN
fInDateOpeningQty := fBForeDateOnHandQty;
fInDateOnHandQty := fBForeDateOnHandQty + rInDateInvRec.onhand
- rInDateInvRec.ship_out;
UPDATE inventory SET
OPENING = fInDateOpeningQty,
ONHAND = fInDateOnHandQty
WHERE date = dloopday + 1
AND co_id = nComponentId
AND gr_id = nGroupId
AND component_name = vComponentName;
ELSE
fInDateOpeningQty := rDayBeforeInvRec.wwin_onhand;
fInDateOnHandQty := rDayBeforeInvRec.wwin_onhand;
INSERT INTO wste_waste_inventory (
CO_ID,
RECEIVE,
SHIP_OUT,
ONHAND,
OPENING,
DATE,
GR_ID,
COMPONENT_NAME )
VALUES (
nComponentId,
0,
0,
fInDateOpeningQty,
fInDateOnHandQty,
dToDate,
nGroupId,
vComponentName );
END IF;
CLOSE InDate_Rec_Exist;
EXIT WHEN Day_Before_Inv_Bal%NOTFOUND;
END LOOP;
CLOSE Day_Before_Inv_Bal;
COMMIT;
dLoopDay := dLoopDay + 1;
END LOOP;
COMMIT;
END Inv_Rec;Edited by: newBJeat on Jun 25, 2009 1:28 AMYou want:
TRUNC(sysdate)if you don't want the time element of a DATE variable.
When you to_date something that's already a date, you introduce a bug, as it forces some implicit conversions:
eg:
to_date(sysdate, 'dd/mm/yyyy')becomes
to_date(to_char(sysdate, <default nls_date_format parameter>), 'dd/mm/yyyy')If your default nls_date_format parameter happens to match the format mask you specify, then you're lucky and the code will work. However, someone with a different format will have an error.
Don't EVER to_date something that's already a date. -
Partitioning on the base of date
hi,
im having a PROBLEM IN CREATING A TABLE containing a date column having range partitioning on it. my table an accompanying error is :
CREATE TABLE A123 (A NUMBER, B DATE)
PARTITION BY RANGE (B)
(PARTITION B1 VALUES LESS THAN (TO_DATE((SYSDATE - INTERVAL '30' DAY),'DD-MON-YYYY')))
(PARTITION B1 VALUES LESS THAN (TO_DATE((SYSDATE - INTERVAL '30' DAY),'DD-MON-YYYY')))
ERROR at line 3:
ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE
i'v also tried it as:
CREATE TABLE A123 (A NUMBER, B DATE)
PARTITION BY RANGE (B)
(PARTITION B1 VALUES LESS THAN (TO_DATE(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')))
(PARTITION B1 VALUES LESS THAN (TO_DATE(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')))
ERROR at line 3:
ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE
as shown above,,i want to create partitions of the table A123 column b which is of date datatype,,i want to have a partition which stores data of SYSDATE - 30,.
Any suggestions/recommendations would be appreciated.
thanx
Regardshi,
sorry im calling u again for support,,
the way u told for creating a table based on date column partitions creates a table with fixed date as a HIGH/UPPER BOUND,,for example if i create a table A123 as :
begin
execute immediate 'CREATE TABLE A123 (A NUMBER, B DATE)
PARTITION BY RANGE (B)
(PARTITION B4 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '90' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
,PARTITION B3 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '60' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
,PARTITION B2 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
,PARTITION B1 VALUES LESS THAN (MAXVALUE))';
end;
ALTER TABLE A123 ENABLE ROW MOVEMENT
now the HIGH VALUE for partition B2 is January 03,2005...
while i want it to be dynamic.
means after 2 months the high value for B2 partition should be (Jan 03,2005 + 2 months)..
can we do this in oracle??
Regards. -
Hi,
on 11g R2 64 bits on Win 2008 R2, when query runs CPU is used at 100%.
AWR says :
Event Waits Time(s) (ms) time Wait Class
DB CPU 2,805 80.1
db file sequential read 5,189 100 19 2.8 User I/O
direct path read 1,633 9 5 .2 User I/O
log file sync 1,245 7 5 .2 Commit
db file scattered read 73 2 24 .0 User I/O
Host CPU (CPUs: 1 Cores: 1 Sockets: 1)And SQL Tunning job, when ran said :
DBMS_SQLTUNE.REPORT_TUNING_TASK('MY_SQL_TUNING_TASK')
Schema Name: userSQL ID : ad7t7wmzzdfmu
SQL Text : SELECT * FROM VW_I
There are no recommendations to improve the statement.Is the CPU utilization to 100% generated from an Oracle process ?
Is there any utility in Win 2008 or Oracle to check the threads from the Windows side ?
Thank you.Thanks to all.
my explain plan is too large and we are limited to 30000 characthers. What can I do ? Here is a part
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 1 | 255 | 1009 (0)|
| 1 | TABLE ACCESS BY INDEX ROWID | PS_NAME_PREFIX_LNG | 1 | 12 | 1 (0)|
|* 2 | INDEX UNIQUE SCAN | PS_NAME_PREFIX_LNG | 1 | | 0 (0)|
| 3 | TABLE ACCESS BY INDEX ROWID | PS_PERSONAL_PHONE | 1 | 29 | 2 (0)|
|* 4 | INDEX UNIQUE SCAN | PS_PERSONAL_PHONE | 1 | | 1 (0)|
| 5 | TABLE ACCESS BY INDEX ROWID | PS_EMAIL_ADDRESSES | 1 | 37 | 2 (0)|
|* 6 | INDEX UNIQUE SCAN | PS_EMAIL_ADDRESSES | 1 | | 1 (0)|
| 7 | SORT UNIQUE | | 1 | 24 | 8 (13)|
| 8 | TABLE ACCESS BY INDEX ROWID | PS_WKF_CNT_TYPE | 1 | 24 | 3 (0)|
|* 9 | INDEX RANGE SCAN | PS_WKF_CNT_TYPE | 1 | | 2 (0)|
| 10 | SORT AGGREGATE | | 1 | 20 | |
|* 11 | INDEX RANGE SCAN | PS_WKF_CNT_TYPE | 1 | 20 | 2 (0)|
|* 12 | INDEX RANGE SCAN | PS_WKF_CNT_TYPE | 1 | 20 | 2 (0)|
| 13 | SORT AGGREGATE | | 1 | 20 | |
|* 14 | INDEX RANGE SCAN | PS_WKF_CNT_TYPE | 1 | 20 | 2 (0)|
|* 15 | TABLE ACCESS BY INDEX ROWID | PS_DEPT_TBL | 1 | 28 | 3 (0)|
|* 16 | INDEX RANGE SCAN | PS4DEPT_TBL | 1 | | 2 (0)|
| 17 | SORT AGGREGATE | | 1 | 21 | |
|* 18 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | 21 | 2 (0)|
|* 19 | TABLE ACCESS BY INDEX ROWID | PS_DEPT_TBL | 1 | 28 | 3 (0)|
|* 20 | INDEX RANGE SCAN | PS4DEPT_TBL | 1 | | 2 (0)|
| 21 | SORT AGGREGATE | | 1 | 21 | |
|* 22 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | 21 | 2 (0)|
|* 23 | TABLE ACCESS BY INDEX ROWID | PS_DEPT_TBL | 1 | 28 | 3 (0)|
|* 24 | INDEX RANGE SCAN | PS4DEPT_TBL | 1 | | 2 (0)|
| 25 | SORT AGGREGATE | | 1 | 21 | |
|* 26 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | 21 | 2 (0)|
|* 27 | TABLE ACCESS BY INDEX ROWID | PS_DEPT_TBL | 1 | 28 | 3 (0)|
|* 28 | INDEX RANGE SCAN | PS4DEPT_TBL | 1 | | 2 (0)|
| 29 | SORT AGGREGATE | | 1 | 21 | |
|* 30 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | 21 | 2 (0)|
| 31 | SORT AGGREGATE | | 1 | 28 | |
|* 32 | TABLE ACCESS BY INDEX ROWID | PS_DEPT_TBL | 1 | 28 | 8 (0)|
|* 33 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | | 7 (0)|
| 34 | SORT AGGREGATE | | 1 | 21 | |
|* 35 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | 21 | 2 (0)|
|* 36 | TABLE ACCESS BY INDEX ROWID | PS_DEPT_TBL | 1 | 28 | 3 (0)|
|* 37 | INDEX RANGE SCAN | PS4DEPT_TBL | 1 | | 2 (0)|
| 38 | SORT AGGREGATE | | 1 | 21 | |
|* 39 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | 21 | 2 (0)|
|* 40 | FILTER | | | | |
| 41 | NESTED LOOPS | | 1 | 255 | 77 (0)|
| 42 | NESTED LOOPS | | 1 | 218 | 76 (0)|
| 43 | NESTED LOOPS | | 1 | 192 | 74 (0)|
| 44 | MERGE JOIN CARTESIAN | | 1 | 101 | 72 (0)|
| 45 | NESTED LOOPS | | 1 | 75 | 69 (0)|
| 46 | NESTED LOOPS | | 3 | 165 | 63 (0)|
| 47 | TABLE ACCESS BY INDEX ROWID| PS_NAMES | 3 | 120 | 60 (0)|
|* 48 | INDEX SKIP SCAN | PSANAMES | 3 | | 57 (0)|
| 49 | SORT AGGREGATE | | 1 | 19 | |
|* 50 | INDEX RANGE SCAN | PS_NAMES | 1 | 19 | 2 (0)|
| 51 | TABLE ACCESS BY INDEX ROWID| PS_PERSON | 1 | 15 | 1 (0)|
|* 52 | INDEX UNIQUE SCAN | PS_PERSON | 1 | | 0 (0)|
| 53 | TABLE ACCESS BY INDEX ROWID | PS_PERS_DATA_EFFDT | 1 | 20 | 2 (0)|
|* 54 | INDEX RANGE SCAN | PS_PERS_DATA_EFFDT | 1 | | 1 (0)|
| 55 | SORT AGGREGATE | | 1 | 15 | |
|* 56 | INDEX RANGE SCAN | PS_PERS_DATA_EFFDT | 1 | 15 | 2 (0)|
| 57 | BUFFER SORT | | 1013 | 26338 | 70 (0)|
| 58 | INDEX FAST FULL SCAN | PS4DEPT_TBL | 1013 | 26338 | 3 (0)|
|* 59 | TABLE ACCESS BY INDEX ROWID | PS_JOB | 1 | 91 | 2 (0)|
|* 60 | INDEX RANGE SCAN | PS1JOB | 1 | | 1 (0)|
|* 61 | TABLE ACCESS BY INDEX ROWID | PS_JOB | 1 | 26 | 3 (0)|
|* 62 | INDEX RANGE SCAN | PSAJOB | 1 | | 2 (0)|
| 63 | SORT AGGREGATE | | 1 | 17 | |
|* 64 | INDEX RANGE SCAN | PSAJOB | 4 | 68 | 2 (0)|
| 65 | SORT AGGREGATE | | 1 | 20 | |
|* 66 | INDEX RANGE SCAN | PSAJOB | 1 | 20 | 2 (0)|
| 67 | SORT AGGREGATE | | 1 | 17 | |
|* 68 | INDEX RANGE SCAN | PSAJOB | 4 | 68 | 2 (0)|
| 69 | SORT AGGREGATE | | 1 | 20 | |
|* 70 | INDEX RANGE SCAN | PSAJOB | 1 | 20 | 2 (0)|
| 71 | TABLE ACCESS BY INDEX ROWID | PS_JOBCODE_TBL | 1 | 26 | 2 (0)|
|* 72 | INDEX RANGE SCAN | PS_JOBCODE_TBL | 1 | | 1 (0)|
| 73 | SORT AGGREGATE | | 1 | 20 | |
|* 74 | INDEX RANGE SCAN | PS_JOBCODE_TBL | 1 | 20 | 2 (0)|
| 75 | TABLE ACCESS BY INDEX ROWID | PS_JOB_CL_I | 1 | 37 | 1 (0)|
|* 76 | INDEX UNIQUE SCAN | PS_JOB_CL_I | 1 | | 0 (0)|
| 77 | SORT AGGREGATE | | 1 | 21 | |
|* 78 | INDEX RANGE SCAN | PS_DEPT_TBL | 1 | 21 | 2 (0)|
Predicate Information (identified by operation id):
2 - access("L"."NAME_PREFIX"=:B1 AND "L"."LANGUAGE_CD"='FRA')
4 - access("F"."EMPLID"=:B1 AND "F"."PHONE_TYPE"='BUSN')
6 - access("G"."EMPLID"=:B1 AND "G"."E_ADDR_TYPE"='BUSN')
9 - access("H"."EMPLID"=:B1 AND "H"."CONTRACT_NUM"=:B2)
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_WKF_CNT_TYPE" "W"
WHERE SYS_OP_DESCEND("EFFDT") IS NOT NULL AND
SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-
MM-DD')) AND "W"."CONTRACT_NUM"=:B1 AND "W"."EMPLID"=:B2 AND
SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YY
YY-MM-DD')))
11 - access("W"."EMPLID"=:B1 AND "W"."CONTRACT_NUM"=:B2 AND
SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-
MM-DD')) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL)
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDATE@!,'YY
YY-MM-DD'),'YYYY-MM-DD'))
12 - access("H"."EMPLID"=:B1 AND "H"."CONTRACT_NUM"=:B2)
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_WKF_CNT_TYPE" "W"
WHERE SYS_OP_DESCEND("EFFDT") IS NOT NULL AND
SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-
MM-DD')) AND "W"."CONTRACT_NUM"=:B1 AND "W"."EMPLID"=:B2 AND
SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YY
YY-MM-DD')))
14 - access("W"."EMPLID"=:B1 AND "W"."CONTRACT_NUM"=:B2 AND
SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-
MM-DD')) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL)
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDATE@!,'YY
YY-MM-DD'),'YYYY-MM-DD'))
15 - filter("DEPT"."EFF_STATUS"='A')
16 - access("DEPT"."MANAGER_ID"=:B1 AND "DEPT"."SETID"='SHARE' AND
"DEPT"."DEPTID"='F0100R')
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_DEPT_TBL" "DEPT1"
WHERE "DEPT1"."DEPTID"=:B1 AND "DEPT1"."SETID"=:B2))
18 - access("DEPT1"."SETID"=:B1 AND "DEPT1"."DEPTID"=:B2)
19 - filter("DEPT"."EFF_STATUS"='A')
20 - access("DEPT"."MANAGER_ID"=:B1 AND "DEPT"."SETID"='SHARE')
filter(SUBSTR("DEPT"."DEPTID",4,1)='0' AND (SUBSTR("DEPT"."DEPTID",1,1)='R' OR
SUBSTR("DEPT"."DEPTID",1,1)='C') AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))=
(SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_DEPT_TBL"
"DEPT1" WHERE "DEPT1"."DEPTID"=:B1 AND "DEPT1"."SETID"=:B2))
22 - access("DEPT1"."SETID"=:B1 AND "DEPT1"."DEPTID"=:B2)
23 - filter("DEPT"."EFF_STATUS"='A')
24 - access("DEPT"."MANAGER_ID"=:B1 AND "DEPT"."SETID"='SHARE')
filter(SUBSTR("DEPT"."DEPTID",1,1)='F' AND SUBSTR("DEPT"."DEPTID",4,1)='0' AND
"DEPT"."DEPTID"<>'F0100R' AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_DEPT_TBL" "DEPT1"
WHERE "DEPT1"."DEPTID"=:B1 AND "DEPT1"."SETID"=:B2))
26 - access("DEPT1"."SETID"=:B1 AND "DEPT1"."DEPTID"=:B2)
27 - filter("DEPT"."EFF_STATUS"='A')
28 - access("DEPT"."MANAGER_ID"=:B1 AND "DEPT"."SETID"='SHARE')
filter(SUBSTR("DEPT"."DEPTID",4,1)<>'0' AND
SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_DEPT_TBL" "DEPT1"
WHERE "DEPT1"."DEPTID"=:B1 AND "DEPT1"."SETID"=:B2))
30 - access("DEPT1"."SETID"=:B1 AND "DEPT1"."DEPTID"=:B2)
32 - filter("DEPTM"."EFF_STATUS"='A')
33 - access("DEPTM"."SETID"='SHARE')
filter(SUBSTR("DEPTM"."DEPTID",4,1)='0' AND
SUBSTR("DEPTM"."DEPTID",1,3)=SUBSTR(:B1,1,3) AND
SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_DEPT_TBL" "DEPT1"
WHERE "DEPT1"."DEPTID"=:B2 AND "DEPT1"."SETID"=:B3))
35 - access("DEPT1"."SETID"=:B1 AND "DEPT1"."DEPTID"=:B2)
36 - filter("DEPT"."EFF_STATUS"='A')
37 - access("DEPT"."MANAGER_ID"=:B1 AND "DEPT"."SETID"='SHARE')
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_DEPT_TBL" "DEPT1"
WHERE "DEPT1"."DEPTID"=:B1 AND "DEPT1"."SETID"=:B2))
39 - access("DEPT1"."SETID"=:B1 AND "DEPT1"."DEPTID"=:B2)
40 - filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_DEPT_TBL" "Y" WHERE
SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DAT
E(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-MM-DD')) AND "Y"."DEPTID"=:B1 AND
"Y"."SETID"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDATE
@!,'YYYY-MM-DD'),'YYYY-MM-DD')))
48 - access("C"."NAME_TYPE"='PRI')
filter("C"."NAME_TYPE"='PRI' AND "C"."EFFDT"= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_NAMES" "J" WHERE
SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DAT
E(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-MM-DD')) AND "J"."NAME_TYPE"=:B1 AND
"J"."EMPLID"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDAT
E@!,'YYYY-MM-DD'),'YYYY-MM-DD')))
50 - access("J"."EMPLID"=:B1 AND "J"."NAME_TYPE"=:B2 AND
SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-
MM-DD')) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL)
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDATE@!,'YY
YY-MM-DD'),'YYYY-MM-DD'))
52 - access("C"."EMPLID"="D"."EMPLID")
54 - access("D"."EMPLID"="E"."EMPLID")
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_PERS_DATA_EFFDT" "S"
WHERE SYS_OP_DESCEND("EFFDT") IS NOT NULL AND
SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DATE(TO_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-
MM-DD')) AND "S"."EMPLID"=:B1 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(T
O_CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-MM-DD')))
56 - access("S"."EMPLID"=:B1 AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(TO_DATE(TO_
CHAR(SYSDATE@!,'YYYY-MM-DD'),'YYYY-MM-DD')) AND SYS_OP_DESCEND("EFFDT") IS NOT NULL)
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(TO_CHAR(SYSDATE@!,'YY
YY-MM-DD'),'YYYY-MM-DD'))
- 'PLAN_TABLE' is old version -
Sysdate from oracle db in mm/dd/yyyy hh24:mi:ss format
I am trying to get sysdate from oracle db in mm/dd/yyyy hh24:mi:ss format but the result it gives back is 00:00:00 for hh24:mi:ss.
code:
try
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection( connStr, userName, passWord );
PreparedStatement pstmtQuery = con.prepareStatement(" SELECT to_date(to_char(sysdate,'mm/dd/yyyy hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss') SYS_DATE FROM DUAL" );
ResultSet rsQuery = pstmtQuery.executeQuery();
DateFormat localFormat1 = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
java.sql.Date date3 = null;
if(rsQuery.next())
date3 = rsQuery.getDate("SYS_DATE");
System.out.println("\ndatabase sysdate: " + localFormat1.format( date3 ));
catch (SQLException sqle)
sqle.printStackTrace();
catch (java.lang.Exception e)
e.printStackTrace();
}When you use the to_date function, the result you get back will be in the default date format as specified by the nls_date_format property. The data is stored properly (i.e., it includes the time values), but when it's displayed it's displayed in the standard format. So even if the datetime is 10/11/2001 10:12:35, the value that will be displayed when you select sysdate will be 11-OCT-01 if you're using the default date format of DD-MON-YY.
Are you sure that your statement is returning the desired string when you type it directly into SQL? If so, then I have to guess that your default date format is set up the way you want it when you go into SQL directly, but that a different default date format is used when you're executing the statement via jdbc.
I've never tried setting the default date format through jdbc, so I don't know if it will work, but the way to set the format is to alter the session:
alter session set nls_date_format = 'mm/dd/yyyy hh24:mi:ss';
HTH,
Rich
Maybe you are looking for
-
Recent photos from my iPhone no longer appear in my iPhoto library, or at least I can't find them. I just looked at them in iPhoto yesterday or the day before. Baffling. Photos from my other device (camera) do show up okay, although the "Last 12 mont
-
Error when add a custom field to source 2LIS_12_VCHDR
Hi Experts, I'm trying add a custom field to source 2LIS_12_VCHDR. The fields are in LIKP table's append. That are zz fields. I can see the fields in MCLIKP structure, but I can't see these fields in LBWE transacction when I try update the structure
-
CS3 Web Premium Suite compatible with Vista 64 bit?
Greeting folks. I realize this is not a Photoshop specific question, but does anyone use CS3 Web Premium Suite on Vista 64? If so, do you have any problems with any of the programs? I'm contemplating upgrading from Vista 32 to Vista 64. Thanks!
-
I was trying to enable FileVault on my iMac where I just have been installing a clean OS X Mountain Lion. My iMac has a SSD and a HDD, and the OS is installed on the SSD. I enabled the FileVault in System Preferences, but after the iMac reboots it gi
-
Third Party Sample plug is sound out of tune in Logic X
Hi there: I am using external libraries as plug ins with Logic X, and I am getting a few instruments sounding way out of tune. Initially I noticed it with the Vienna Symphonic Library, and now I am having the same problem with East/West smaples. Wha