To get actual age from sysdate
sir,
i did what syntax u have provided but failed to get the value.
please check my query where had done wrong.
SQL>select trunc((to_char(&sysdate, 'mm/dd/yyyy')-to_char(&birthday, 'mm/dd/yyyy'))/10000)as age
from dual;
Enter value for sysdate: '10/14/2006'
Enter value for birthday: '02/08/1980'
select trunc((to_char('10/14/2006', 'mm/dd/yyyy')-to_char('02/08/1980', 'mm/dd/yyyy'))/10000)as age
ERROR at line 1:
ORA-01722: invalid number
but LAURENT SCHNEIDER is one of oracle certified master, who posted it.
does this syntax wrong????
please revert my question back.
How old are you?
I just come back from holiday, I am quite busy at the moment. Here is a tiny function to get the age
trunc((to_char(sysdate,'YYYYMMDD')-to_char(birthdate,'YYYYMMDD'))/10000)
it is much safer than add_months, because add_months do some conversion at the end of the month, and I would never accept to wait until Feb 29th, 2008 (28-2-1990 + 18*12 months) to be 18 if I were born Feb 28th, 1990.
POSTED BY LAURENT SCHNEIDER AT 5:43 PM
1 COMMENTS:
Anonymous said...
oh greate!!
def birthdate = to_date('2000/02/29','yyyy/mm/dd')
def sys_date = to_date('2003/02/28','yyyy/mm/dd')
select
trunc((to_char(&sys_date,'YYYYMMDD')-to_char(&birthdate,'YYYYMMDD'))/10000) as age from dual;
def sys_date = to_date('2003/03/01','yyyy/mm/dd')
select
trunc((to_char(&sys_date,'YYYYMMDD')-to_char(&birthdate,'YYYYMMDD'))/10000) as age from dual;
thanxx in advance
Similar Messages
-
How to get actual value from LOV list
Like Subject says: How to get actual value from LOV list. Any help will be appreciated.
Thanks.Thanks Shay, I did it with bind variable because I'm not using JSF. Is there any chance to post solution using standard JSTL or HTML expression. I have something like this: LOV displays some Companies names:
<html:select property="UserJobCompanyId"
disabled="${!bindings[\'UserJobCompanyId\'].updateable}"
onchange="submitform();">
<html:optionsCollection label="prompt" value="index" property="UserJobCompanyId.displayData"/>
</html:select>and I want to get CompanyID of selected Company.
Thanks, again. -
How to get actual error from Crystal Report
We are using Crystal report in web service.
We faced some problem due to crystal report unexpected error.
Refer the below error message.
Xception E NSF NSFZ1100 20100608 145511565 GPRAB0 : GPRZ10 GUEC0001 [1] AbstractService Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Xception E NSF NSFZ1100 20100608 145511972 GPRAB0 : GPRZ10 GUEC0001 [1] AbstractService at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
at System.Windows.Forms.MessageBox.Show(String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon)
at CrystalDecisions.Windows.Forms.CrystalReportViewer.HandleExceptionEvent(Object eventSource, Exception e, Boolean suppressMessage)
at CrystalDecisions.Windows.Forms.CrystalReportViewer.HandleExceptionEvent(Object eventSource, Exception e)
at CrystalDecisions.Windows.Forms.ReportDocumentBase.GetLastPageNumber()
at CrystalDecisions.Windows.Forms.ReportDocumentBase.GetLastPage()
at CrystalDecisions.Windows.Forms.DocumentControl.ShowLastPage()
at CrystalDecisions.Windows.Forms.PageView.ShowLastPage()
at Biz.Nissan.Cats.CORE.REPORT.LibCrystalReport.TotalPageCount(ReportDocument Rpt)
at Biz.Nissan.Cats.CORE.REPORT.LibCrystalReport.Print(BaseReport RptDefinition)
at Biz.Nissan.Cats.CORE.REPORT.MCTLIST260Print.Print(IFData ifData)
at Biz.Nissan.W3.CATS.BC.Service.DistributeService.ExecuteMpp()
How we get the actual error from crystal report?
Thanks in AdvanceSame as
crystal report unexpected error in Web service (IIS)
Closing this thread.
Ludek -
Get # of month from sysdate
Hi all,
I have a table name emp is defined as:
ename varchar2(20),
hiredate date,
I want to display the employee name and calculate the number of months between today and the date the employee was hired. But I don't how to substract
from sysdate with the hiredate to display the # of months.
Please help
Thanks in advance,
JPYou can use MONTHS_BETWEEN function. See
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/functions089.htm#i78039 -
Problem with getting actual data from Detail in Master/Detail
Hi.
I'm using master-detail tables (based on Read-Only view objects connected with view link).
In those tables some columns are inputText, so that user can change data for the use of stored procedure only (I don't want to change data showed in tables, just need a possibility to modify it before passing arguments to procedure)
The problem is when I get data from rows from detail view (Read Only with attributes set to "updatable always") it's not the data user entered in the table (there is no problem in master table) but the data fetched from database.
This is the way I do it in backing been:
Row[] masterRows = view.getAllRowsInRange();
for (int i = 0; i < masterRows .length; i++){
MasterRowImpl row = (MasterRowImpl )masterRows;
System.out.println("Group name:" + row.getGroup())
RowIterator rowIterator = row.getDetailsView();
while(rowIterator.hasNext()){
DetailsViewRowImpl detailRow = (DetailsViewRowImpl )rowIterator.next();
System.out.println("User name: " + detailRow.getName())
So if (for example) in database I have Group1, with 3 detail rows: John1,John2,John3;
and user in Tables displayedon page changes it like this:
Group1_changed, John1, John2_blah, John333
After executing the code above I get:
Group name: Group1_changed
User name: John1
User name: John2
User name: John3
Is it a normal behaviour?
ps. When I use entity based view objects there is no problem, but I want to use ReadOnly View Objects.this is my function that reads the data:
while( ( ch = dis.read() ) != -1 ){
mess.append((char)ch);
licz++;
if(licz>prog){
licz=0;
//gauge.setValue();
when i use just mess.append(dis.readUTF()))
i get en exception:
java.io.EOFException
at java.io.DataInputStream.readFully(+45)
at java.io.DataInputStream.readUTF(+32)
at java.io.DataInputStream.readUTF(+4)
at KConnection.KConnector.connect(+137)
at SerwisMain.download(+25)
at SerwisMain.ok(+415)
at KGUI.KInput.commandAction(+209)
at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+152)
at com.sun.kvem.midp.lcdui.EmulEventHandler$EventLoop.run(+459) -
Not able to get the actual plan from trace file
Hi all
I have a Db package and want to get actual execution plan of all the statements in that pakcage it does provides the plan for System's statements but does not displays the plan for Sql statements
DB version 9.2.0 using the following sequence of insructions
set timing on
set serveroutput on
alter session set events '10046 trace name context forever ,level 12';
begin
run_service.collect_data(sysdate);
end;
alter session set sql_trace=false;
exit; ---exit from Sql
now look at the output
select distinct obj#,containerobj#,pflags,xpflags,mflags
from
sum$, suminline$ where sumobj#=obj# and inline#=:1
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 1 1 0 0
total 3 0.00 0.00 1 1 0 0
Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: SYS (recursive depth: 2)
Rows Row Source Operation
0 SORT UNIQUE
0 NESTED LOOPS
0 TABLE ACCESS BY INDEX ROWID SUMINLINE$
0 INDEX RANGE SCAN I_SUMINLINE$_2 (object id 1614116)
0 TABLE ACCESS BY INDEX ROWID SUM$
0 INDEX UNIQUE SCAN I_SUM$_1 (object id 319)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 1 0.00 0.00
SELECT SEQ_NUM, S_DATE, S_TIME, CSTATUS, G_SERVICE,
B_REFERENCE, V_REFERENCE, M_PRIORITY
FROM GL_HIST
ORDER BY S_DATE DESC, S_TIME DESC
call count cpu elapsed disk query current rows
Parse 1 0.01 0.01 0 0 0 0
Execute 2819 0.37 0.32 0 0 0 0
Fetch 2819 2.50 20.47 2786 20164 0 2819
total 5639 2.88 20.81 2786 20164 0 2819
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 15550 (recursive depth: 1)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 2786 0.05 18.19
latch free 4 0.04 0.06
UPDATE G_ORIG SET G_SERVICE = :B1
WHERE
SEQ_NUM = :B5 AND S_DATE = :B4 AND S_TIME = :B3 AND
C_STATUS = :B2 AND NVL(G_SERVICE, '+') <> NVL(:B1, '+')
call count cpu elapsed disk query current rows
Parse 1 0.00 0.03 0 0 0 0
Execute 3731 0.74 0.99 261 18712 119 54
Fetch 0 0.00 0.00 0 0 0 0
total 3732 0.74 1.02 261 18712 119 54
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 15550 (recursive depth: 1)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 261 0.01 0.19
latch free 9 0.01 0.04
COMMITRemove the line alter session set sql_trace=false and just exit/disconnect. The explain plain is contained in the STAT lines in the trace file and are only written when the cursor closes. If you turn off tracing before the cursor closes the STAT lines will not get written.
-
Hi All,
I am using BI report for plan and actual cost deviation of Work order(maintenance order) of PM(tcode iw33>cost tab>plan actual cost to check),
question there is 2 query for this plan actual cost deviation, one on 0pm_c01(Maintenance Orders - Costs and Allocations) and second on 0PM_C07 Maintenance Orders: Scheduling, datasource is common 0PM_OM_OPA_2 for actual cost population in this cubes, BUT update rule are diffrent for both target,
in 0pm_c07 its getting update by 0pm_ds04(dso) where we are getting only Actual cost with Debit(S) Entery(as debit(S) entery hardcoded at start routine in update rule from this datsource to 0pm_ds04), for report on 0pm_c07actual cost is matching with standard ecc report MCI8 - PMIS: Cost Analysis.
in 0pm_c03 we are getting all Actual cost entry both Debit(S) and Credit(H), getting actual cost total as debit minus credit entry at cube 0pm_c03 and hence getting same on report on that, this report is same as like report on 0pm_c07.
both report are calculating Actual vs Plan cost relation ship, but one report(on 0pm_c07) have only debit(S) entry while other report(on 0pm_c03) have both Debit and Credit entery, So getting diffrent Actual cost at both report hence diffrent Actual VS plan Cost relationship from both report,
Both are standard report given by SAP, Now which report we have to take it as correct one? which report is right?
Regards,
Dushyant.Hi,
Sorry, In my pain post whereever i written 0pm_c03 is wong its 0pm_c01,
as u said ur query on 0pm_c01 works fine? are u getting Debit(S) and credit(H) both entery for actual cost in this cube?
as in 0pm_c07 we are gettin only debit(S) entery and this report matching with standard ecc reprot( as i mentioned in main post ) BUT for 0pm_c01 its have both S and H entery. if ur actual/plan cost report on 0pm_c01 have S and H entery for actual cost than with ECC report you are reconciling?
Dushyant. -
I have years worth of music on my PC that is about to die. If I get an iPad is there anyway to get the music from my PC onto the iPad? I have the iCloud but my understanding is only music actually purchased from iTunes lives int he cloud. I have music that was legally purchased and loaded to my iTunes account from cd's that I no longer own. I need a new laptop and am deciding between the iPad and the Mac book. I use the computer for music, photos, and web - nothing else and nothing fancy. I don't know that there is a way to save my huge music library without saving it to an external hard drive and then loading it to a new one (does the iPad have a port to plug an external hard drive into?)
First, you would need to make a backup of the entire iTunes folder on the PC. You could get music to the iPad if the PC was still functioning, or you would have to move the music to another computer. An iPad is not a laptop, and does not have a port to plug an external drive into. You can sync music to the iPad from the computer, but you are correct, unless you get iTunes Match, you would need a computer to copy the music to and then sync to an iPad.
-
How to get the current week from sysdate?
Hi sir,
i want to know how to get the current week from sysdate?
thanksHi Nicolas
It seems you like to check my post and also make commend ;) thanks for your attention
Have you ever read the posts above and given solutions ?Yes, I did
Have you read the docs ? Yes, I checked
What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
=> Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
Hope my answer could satisfy you..
One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
Thank you
Regards
Helios -
How to Get Millisec from Sysdate
Hello all
How to get millisec from sysdate.
Pls let me know da query ..You can't get milliseconds from SYSDATE. In 9i and upwards you can get them from a timestamp, whether it be from the built-in functions SYSTIMESTAMP and LOCALTIMESTAMP or a timestamp column/variable of your own.
Unfortunately, Oracle only supplies the means to extract seconds, but fortunately, this includes the millilseconds, which are easy enough to get to as the following demonstrates:-
SQL> select extract(second from localtimestamp) from dual;
EXTRACT(SECONDFROMLOCALTIMESTAMP)
42.765535
SQL> select mod(extract(second from systimestamp),1) from dual;
MOD(EXTRACT(SECONDFROMSYSTIMESTAMP),1)
.181223Regards
Adrian -
What to do if I get an SMS from my bank that I have used my iTunes for 13.90$ but actually I didn't buy anything.
Actually I have done that I have called my bank, but am not sure about apple do you have the right contact details.
-
How to get the difference in years from sysdate
Hi all,
I want to display years from 2005 to sysdate. I have tried this, but it is giving same SYSDATEs year 6 times.
SELECT EXTRACT(YEAR FROM SYSDATE + LEVEL -1) FROM DUAL CONNECT BY LEVEL < TRUNC(MONTHS_BETWEEN (SYSDATE,TO_DATE('2005','YYYY'))/12)
Thanks in advance,
PalHi dude,
Try this code
DECLARE
from_dt DATE := TO_DATE ('01/01/2009', 'mm/dd/yyyy');
to_dt DATE
:= TO_DATE (TO_CHAR (SYSDATE, 'mm/dd/yyyy') /*'01/01/2010'*/,
'mm/dd/yyyy'
x VARCHAR2 (30);
BEGIN
WHILE NOT from_dt > to_dt
LOOP
IF TO_DATE (x, 'dd-mon-yyyy') >= to_dt
THEN
DBMS_OUTPUT.put_line ('hello');
EXIT;
ELSE
DBMS_OUTPUT.put_line ('FROM DATE ==>' || from_dt);
x := from_dt + 1;
IF TO_DATE (x, 'DD-MON-YYYY') > to_dt
THEN
DBMS_OUTPUT.put_line ('Exit Now');
ELSE
DBMS_OUTPUT.put_line ('Sundays -->' || x);
END IF;
END IF;
from_dt := from_dt + 1;
END LOOP;
END;Regards,
N.Senthil. -
How can i get all values from jtable with out selecting?
i have one input table and two output tables (name it as output1, output2). Selected rows from input table are displayed in output1 table. The data in output1 table is temporary(means the dat wont store in database just for display purpose).
Actually what i want is how can i get all values from output1 table to output2 table with out selecting the data in output1 table?
thanks in advance.
rajaYou could set the table's data model to be the same:
output2.setModel( output1.getModel() ); -
Getting the Values from a Tiled View
Hi,
I have a TiledView and I have checkbox in the tiled view. I am trying
to get the values of the checked boxes.
I have coded like this.
Object[] links = getRSystemLinks().getCbSystemUrl().getValues();
if I see the links.length i get only one. In html If I see the code
it appends the TileIndex in brackets. If I replace the TileIndex with
0 in all the fields in endCbSystemUrl method I get the correct values.
In the TiledView beginDisplay() method my code is like this.
if (getPrimaryModel() == null) throw new ModelControlException
("Primary model is null");
super.beginDisplay();
resetTileIndex();
pgCustomizeLinksViewBean parentBean = (pgCustomizeLinksViewBean)
getParent();
((DatasetModel) getDefaultModel()).setSize
(parentBean.SystemChoicesValue.size());
Any Suggestions on this.
Thanks
NamburiNamburi--
Remember, the getValues() method does not return the values from a column in
a TiledView. It is strictly for use by fields that can have multiple
values, like multi-select list boxes.
DO NOT remove the indexing feature from the field names, especially in the
case of checkboxes, because checkboxes aren't submitted back to the server
unless they are checked. By overriding the automatic checkbox tracking
feature JATO provides, you won't be able to tell which checkboxes were
actually checked by row--you'll simply get back a list the same size as the
number of checkboxes that were checked, without any placeholders for the
ones that weren't checked.
Instead, on submit, you simply need to move through the tiledView and check
the value of checkbox on each row:
tiledView.beforeFirst();
while (tiledView.next())
if (getDisplayFieldBooleanValue("myCheckBox"))
You can use the same construct to build up an array or list:
List checkedList=new LinkedList();
tiledView.beforeFirst();
while (tiledView.next())
if (getDisplayFieldBooleanValue("myCheckBox"))
checkedList.add(new Boolean(true))
else
checkedList.add(new Boolean(false))
Todd
Todd Fast
Senior Engineer
Sun Microsystems, Inc.
todd.fast@s...
----- Original Message -----
From: <vnamboori@y...>
Sent: Wednesday, October 17, 2001 3:49 PM
Subject: [iPlanet-JATO] Getting the Values from a Tiled View
Hi,
I have a TiledView and I have checkbox in the tiled view. I am trying
to get the values of the checked boxes.
I have coded like this.
Object[] links = getRSystemLinks().getCbSystemUrl().getValues();
if I see the links.length i get only one. In html If I see the code
it appends the TileIndex in brackets. If I replace the TileIndex with
0 in all the fields in endCbSystemUrl method I get the correct values.
In the TiledView beginDisplay() method my code is like this.
if (getPrimaryModel() == null) throw new ModelControlException
("Primary model is null");
super.beginDisplay();
resetTileIndex();
pgCustomizeLinksViewBean parentBean = (pgCustomizeLinksViewBean)
getParent();
((DatasetModel) getDefaultModel()).setSize
(parentBean.SystemChoicesValue.size());
Any Suggestions on this.
Thanks
Namburi
[email protected] -
How to get the data from a cluster table to BW
Dear All,
I want to extract the data from R/3 to BW by using 2 tables and one Cluster B2.
Actually my report contains some fields from PA2001, PA2002 and one cluster table B2 (Table ZES). Can I create View by using these 3 tables? If it is not possible how can I get the data from the cluster? Can I create generic datasource by using cluster tables directly?
In SE11 Transaction the Cluster (table ZES) is showing invalid table.
I referred some Forums, but no use.
Can any body tell me procedure to get the data from a cluster (table ZES) ?
Waiting for you results.
Thanks and regards
RajeshHI Siggi,
Thank you for your reply..
I am also planning to do FM to get the data. But it is saying that the Cluster table ZES does not exist (ZES is the the standard table, in SE11 also).
How can I use the Fields from the that table.?
What can I do now, can you please explain me about this point.
Waiting for your reply.
Thanks and Regards
Rajesh
Message was edited by:
rajesh
Maybe you are looking for
-
How do I delete multiple stamps or fields done in version 7, but now I have in Acrobat Pro 9
Most of our files were done printed in PDF with version 7. We have inserted a stamp in version 7. But when I open this file in Version 9, these stamps have become field and the usual action in deleting multiple of these was to just go to navigation t
-
HI, I have an HP LaserJet CM415fnw. I would like to print only with the black cartridge even if I want to print from a phone or tablet, or for anyone that wants to use the printer and doesn't know how to set up the printer to print only in black.
-
HR ABAP: Value Range Filtering in F4 help.
Dear Experts, I'm using a common data element and domain used by our team for a field called "Overall Status"! The value range inside the domain for this OS is appended by each individuals, as and on based on individual requirements. Now, i've append
-
Apple Keybord ADB (Anyone knows how to use the power button?)
Hi, I just found my uncle's old Mac SE and I was wondering if anyone knows how to set the power button on the keyboard (Apple Keyboard) model number M0116C? I want this key to work, because it is actualy not working. Tanks!
-
Good morning. I am a real rookie here, we downloaded a movie and now it is listed twice in our video/movie folder. Does this mean we are going to be charged twice? Thank you