Help... Timestamp Conversion
Hi All,
I need to compare LONG datatype with TIMESTAMP,how can i include it in the WHERE clause?
E.g; i need to find last 3 days data.
EMP Table
EmpNo - NUMBER
Ename - VARCHAR2
Entry_Point - LONG datatype
SELECT *
FROM emp
WHERE TRUNC(entry_point) <= TRUNC(SYSTIMESTAMP) - 3;
Above query is showing conversion error.
Please help!
Hello Saubhik,
Sorry for the late reply.
I saw your code with respect to DBMS_LOB.SUBSTR; but there are some error encountered.
Plz find code below.
DECLARE
CURSOR cur IS
SELECT partition_name,table_name, high_value FROM dba_tab_partitions
where table_owner='MIT'
and table_name='ORDER_HDR' ;
vpart dba_tab_partitions.partition_name%type;
vtab dba_tab_partitions.table_name%type;
v_high LONG;
BEGIN
OPEN cur;
LOOP
FETCH cur INTO vpart,vtab,v_high;
EXIT WHEN cur%NOTFOUND;
IF DBMS_LOB.substr(v_high,11,1)<= TRUNC(SYSTIMESTAMP) - 3 THEN
dbms_output.put_line(v_high||' Matched');
END IF;
END LOOP;
CLOSE cur;
END;Error
An error was encountered performing the requested operation:
ORA:01858: a non-numeric character was found where a numeric was expected
ORA:06512: at line 16
018518.00000 - "a non-numeric character was found where a numeric was expected"
*cause: The input data to be converted using a data format model was incorrect.
The input data did not contain a number where a number was required by the format model
*action: Fix the input data or the format model to make sure the elements match in number and type. Then re-try the operation.
Error at line:2
Entry in the table - DBA_TAB_PARTITIONS
partition_name table_name high_value
===========================
SYS_P234645 ORDER_HDR TO_DATE(' 2010-06-09 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
SYS_P235118 ORDER_HDR TO_DATE(' 2010-07-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
Edited by: Sunil G on Sep 28, 2010 5:39 AM
Edited by: Sunil G on Sep 28, 2010 5:40 AM
Similar Messages
-
Urgent Help - Timestamp conversion in ORACLE 9i
Hi Friends
I need a help .We are using DB servers at different GEOgraphical locations. The timestamp is stored as GMT/UTC using the conversion function SYS_EXTRACT_UTC . But when retrieving from DB again I need to convert to the equivalent local time of DB Server . Is there is any way to do this?
Thanks in advance
gopalMr Gopal
I am also having the same problem .
If you find the answer pl mail to me
thanks in advance.
Suresh -
Help to create Materialized View that has timestamp conversion
I need help creating materialized view with timestamp conversion between GMT to LocalTime.
Feel free to make any comments.
Thanks in advance.
jon joaquino;)Here is one way.
1. Alter the table hist_table and add a new column pdt_timestamp.
2. Update the new column using the function 'new_time'
For example,
Update hist_table
set pdt_timestamp = new_time(gmt_timestamp,'GMT','PDT');
3. create a materialized view log on the table 'hist_table' using the syntax
create materialized view log on hist_table
with primary key, rowid, sequence;
4. create a materialized view now using the syntax:
(You have to specify your own storage numbers and tablespace name)
create materialized view mview_hist_table
pctfree 0 tablespace mymview
storage (initial 16k next 16k pctincrease 0)
build immediate
refresh fast on commit
as select uid,gmt_timestamp,pdt_timestamp
from hist_table;
Please test on your test instance before doing it on production. I have tested this on Oracle 10g for Windows 2000. I assumed that column 'uid' is the primary key on the table. I hope this helps.
********************************************************** -
Timestamp conversion problem.
I work in the development of a LabVIEW program that communicates with a
server (written in Java). All acquired data is sent via TCP and the
server can read everything (waveforms and other information). However,
there is a problem in timestamp conversion. We don't know how to
convert the milliseconds correctly. The timestamp is inside a waveform,
so we cannot convert it to formatted string.
Example:
Original timestamp:
13:37:19,639
11/10/2005
String generated with "Flatten to String":
0000 0000 BF71 9ABF A3D7 0800 0000 0000
Converted value (Java server):
13:37:19,000
11/10/2005
Does anyone know the algorithm to obtain the milliseconds from this value: "A3D7 0800"?
Thanks for attention.
My regards,
Vinicius Falseth
Solved!
Go to Solution.There is a faster way. You can extract the timestamp from the waveform using Get Waveform Components.
At that point, you can convert it to whatever you want. Attached
is a VI which shows a simple conversion to milliseconds, losing a lot
of resolution (128 bit timestamp goes to 52 bit double) and a more
complex conversion showing the internal structure of the timestamp (it
is a 128 bit fixed point number with the decimal in the middle).
You can modify the second conversion to do such things as throw away
the integer portion to get higher resolution on the fraction. Or
you could just save to Java using a four-integer structure.
This account is no longer active. Contact ShadesOfGray for current posts and information.
Attachments:
timestamp.llb 48 KB -
Hi,
by definition timestmaps provide date/time in UTC. With knowledge of the timezone it should be possible to calculate the local date and time explicitly. But there is no such function available in HANA. I have a timestamp field on the DB (data type DEC15 or DEC21) and want to provide an additional calculated field, showing local date, or local date/time. There is function UTCTOLOCAL, but this requires wrong importing data formats:
utctolocal(datearg,timezonearg) since it requires a datearg instead of a DEC field. It is obvious, that a correct conversion is not possible without specifying the time additionally.
How am I able to convert a timestamp into DATE and TIME fields?
Thanks and regards,
UlfHi Ulf
Yep, could be that this is not doable in a calculated attribute in an analytic view...
It perfectly works in SQL, so maybe you need to change your tool here.
create column table weired_timestamp (w_ts decimal (15,0))
insert into weired_timestamp values (20140305225959)
select w_ts, to_date(w_ts), to_time(w_ts), to_timestamp (w_ts) from weired_timestamp
W_TS
TO_DATE(W_TS)
TO_TIME(W_TS)
TO_TIMESTAMP(W_TS)
20140305225959
2014-03-05
22:59:59
2014-03-05 22:59:59.0
With that you can move on with the timezone conversion.
If wonder, why
1) the documentation provides a hard coded example only that is not really helpful :
"SELECT UTCTOLOCAL (TO_TIMESTAMP('2012-01-01 01:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'EST') "utctolocal" FROM DUMMY;
instead of a real scenario.
Well, obviously the person who wrote this hadn't had your scenario in mind.
As you're SAP internal, why don't you just provide feedback on that to the documentation team, maybe even providing an improved real-life example?
2) the documentation doesn't refer to both scenarios, SELECTS and calculated fields in views
Likely because it's the SQL reference we are talking about here. But again, that can be a valid point for improvement - mention it to the documentation development team.
3) the HANA documentation is wrong since utctolocal(datearg,timezonearg) should be
utctolocal(timestamparg,timezonearg) including the missing information how to convert ABAP timestamps (DEC) into HANA timestamps (whatever it is?).
Sorry, I don't get this.
HANA provides a specific SQL compliant data type called "timestamp". This is what the functions work upon and that is what the documentation is about.
HANA is a general DBMS platform that is not just there to support the odd ends of ABAP data modelling and encoding.
I agree that there should be documentation on how to deal with ABAP data types when working without an application server. However, this shouldn't be part of the general DB documentation.
Not sure if these things are already part of any ABAP on HANA education material, but the SoH content development teams surely have come across these things and very likely documented them.
As SAP employee you got access to that, so maybe this would be a good place to look for this kind of information for you.
If you still feel this is a bug, fell free and open a internal message on that.
- Lars -
Need help for Conversion Function in Oracle
Hi, Can Any One help me Please.
I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
Thanks In Advance.Hi,
for the Hex-Number-conversion see:
[url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
What number format do you have? YYYMMDD
Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
Please describe further.
Bye
stratmo -
Timestamp conversion error in BPEL
My BPEL process queries a date Column using sql query and inserts the data into the timestamp column of a table.
I am getting following error in the BPEL process.
insert failed. Descriptor name: InsertEdrmsRetentionUpdates.EdrmsRetentionupdates. Caused by: Unparseable date: "2009-10-20 10:13:25.000"
Caused by Exception TOPLINK-3001 (Oracle TopLink - 10g Release 3 (10.1.3.4.0) (Build 080602)): oracle.toplink.exceptions.ConversionException
Exception Description: The object xs:datetime 2009-10-20 10:13:25.0, of class class java.lang.String, could not be converted to class java.sql.Timestamp.
Internal Exception: java.text.ParseException: Unparseable date: "2009-10-20 10:13:25.000".
What is going wrong?
Please help its very urgent..
Thanks,
PrasannaFixed..
Datatype of the Date Column in the DBAdapter for sql query was String.
I changed it to xs:dateTime manually and it worked.
--Prasanna -
String to timestamp conversion
I have a string of the format yyyyMMdd:hh:mm:ss.SSSSS.
I need to convert it to a timestamp value of
the format dd-MMM-yy hh.mm.ss.SSSSS.
I tried the following
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd:hh:mm:ss.SSSSS");
java.util.Date date = sdf.parse(stdate);
java.sql.Timestamp t = new java.sql.Timestamp(date.getTime());
but it didnt work.
Any help will be greatly appreciated.I have a string of the format
yyyyMMdd:hh:mm:ss.SSSSS.
need to convert it to a timestamp value of
he format dd-MMM-yy hh.mm.ss.SSSSS.
I tried the following
SimpleDateFormat sdf = new
SimpleDateFormat("yyyyMMdd:hh:mm:ss.SSSSS");
java.util.Date date = sdf.parse(stdate);
java.sql.Timestamp t = new
java.sql.Timestamp(date.getTime());
but it didnt work.
Any help will be greatly appreciated.
I have a string of the format
yyyyMMdd:hh:mm:ss.SSSSS.
need to convert it to a timestamp value of
he format dd-MMM-yy hh.mm.ss.SSSSS.Timestamps do not have a format - they are just a point in time. The toString() method will return a String representing the Timestamp in some format but this is not the same as having a format.
I tried the following
SimpleDateFormat sdf = new
SimpleDateFormat("yyyyMMdd:hh:mm:ss.SSSSS");
java.util.Date date = sdf.parse(stdate);
java.sql.Timestamp t = new
java.sql.Timestamp(date.getTime());
but it didnt work.What do you mean by "didn't work"? -
Unix timestamp conversion to human readable representation ...
Hi,
I map unix timestamps from MaxDB to the controller context of Web Dynpro and display the results in a table. Is there a smart way to convert the timestamps to human readable date and time? Maybe some way to manipulate the table values with a function before they are written ..?
For now, I create a new node in the context and manually set each value with the according date/time representation ... but thats pretty cumbersome.
Thank you very much for your help!
Cheers,
borisHi Boris,
Check http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html
Date currentTime_1 = new Date(longUnixTimestamp);
String dateString = formatter.format(currentTime_1);
I would suggest you to create a calculated attribute under the same node as initial timestamp value and return a result of SimpleDateFormat.format().
Best regards, Maksim Rashchynski. -
Help -- MP3 conversion problems
Currently converting wave files from SoundTrack Pro into mp3 by using the Automator for encoding and import into i-tunes. Although the wave file sound is clear and clean, the mp3 files have a slight echo/reverb to them and I have not been able to overcome this.
1. Does anybody have a solution to the echo?
2. Is there a better program available for conversion to mp3?
Any help will be appreciated, as clients are not ecstatic about this "new" sound.
Thanks,
Jack Burke
1-800-451-8273The other tip is very helpful, but you can also use iTunes.
Drag your file (AIFF or WAV) into your Library and convert it by rightclicking on it and choosing "Convert selection to ...". Before you do this, set the proper mp3 format in your iTunes preferences (Preferences - Advanced - Importing). I think the default is AAC import, so you have to change that when you need an mp3. Import using mp3 encoder, custom... Then choose something like 192 or better kbps bitrate, [x] Use Variable Bit Rate Encoding and Joint Stereo. This will render a pretty decent mp3 file.
Good luck!
Hens Zimmerman
Podcast: http://soundsgood.37hz.net -
Unix timestamp to Oracle timestamp conversion
Hi all,
I am trying to convert the UNIX timestamp to ORACLE timestamp .
I have done like this upto now.
CREATE OR REPLCACE FUNCTION unixts_to_oraclets(unixtimestamp IN INTEGER)
RETURN DATE IS
result DATE;
BEGIN
result := TO_DATE('1970-01-01', 'YYYY-MM-DD') + numtodsinterval(unixtimestamp, 'SECOND');
return(result);
end unixts_to_oraclets;
now i have run this query
SQL> select unixts_to_oraclets(1139291114) as TS from dual;
TS
07-FEB-06
now i need the ouput to like this 07-FEB-06 01:10:12
for that i have done like this:
DECLARE
v_date DATE;
res_date DATE;
BEGIN
SELECT from_uts(1139291114)INTO v_date FROM dual;
SELECT TO_TIMESTAMP(v_date,'DD-MON-RRHH24.MI.SS.FF') INTO res_date FROM dual;
DBMS_OUTPUT.PUT_LINE(res_date);
END;
but the output is :
SQL> /
07-FEB-06
PL/SQL procedure successfully completed.
why is that it is not printing 07-FEB-06 01:10:12 ?
how should i moodify the code to get the desired output.
please help me i this regard
Trinath Somanchi,
Hyderabad.SQL> exec dbms_output.put_line(sysdate);
07-FEB-06
PL/SQL procedure successfully completed.
SQL> exec dbms_output.put_line(to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS'));
07-02-2006 02:48:35
PL/SQL procedure successfully completed.
SQL> alter session set nls_date_format='DD-MM-YYYY HH24:MI:SS';
Session altered.
SQL> exec dbms_output.put_line(sysdate);
07-02-2006 02:49:03
PL/SQL procedure successfully completed. -
Time String to Timestamp Conversion Problem
Hi,
I attempted to convert time string to timestamp but I failed. What is the wrong with it? I need a timestamp to create waveforms.
Egemen
Solved!
Go to Solution.
Attachments:
Time String to Timestamp.png 18 KBYou are right Gogineni, when I got the error, I was using %S in the format string for Format Date/Time String function and %3u in the format string for Scan From String.
I found the solution in this thread - use %S%3u in both places.
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help. -
Please Help, make conversion UOM in query or Update Infocube?
Hi!
I have a new requirement, but I don't know how I can solved, I write in order to ask help :
The requiremen is: we have an information on InfoCube, this information contain Quanity original of the invoice... we save this vale on ZCANTIDAD, and before the information is sent into ODS and Infocube, we make some calculation in order to calculate Quantity in UOM BASe, for this calculation, we consult other ODS that contain conversion factor for material (numerator / denominator), the situation is that at after we calculate and save the information in ODS and Infocube, we later receive more conversion factors (numerator and denomintaror), so, we need to update information, as many times as we receive more and more conversion factor.
The way that I know Is delete de Infocube and ODS with information and charge again, but it's a lot of volume, many records,
Is it posible and recomendable update data of the infocube directly ??..this mean with abap code?,
I was thinking about combinate my Infocube with information with the ODS of information of UOM and conversion facotr, but it's not possible, becasue the fields are not the same..
Does anybody know is it possible make something directly inthe query, just to display a dinamic value??...but how can I make a query form different infoobjetct?... only if this a multiprovider?
I will apreciate your help.
Alice.Thank you Frederick
Let me explain more details.
I have one ODS with all information about Invoices (one field it's calculated at the time when I upload the information from PSA to ODS... at the time when the information it's upload, we have a routine that read other ODS with all the conversion factor's... this looks fine.. at the moment when I load the information.
But, later (every day) I receive more and more conversion factor, so the field fill in the ODS of invoices it´s not updated, this mean that I need to download all, and load again... this is crazy because we have a lot of information.
The user want to see in the report the information updated at the time when he execute the report,
I was reading something about virtual key figures, I try to implement, but this didn't give me a result in the query.... in addition I read that this way spend a lot of time and we will hace problems or performance..
Do you know another way to update Key figures during the execution of query?
Thank you a lot.
Alicia -
I have written a program for the hosting company I work with
to provide users with statistical information. It works great for
clients using coldfusion. Thats who we have the most of anyway.
However clients using any other language it does not work for. I
was wondering if there is some javascript I could use so when
someone clicks the link I provided and they go thru cflocation to
the end users website if I could send about three variables in
javascript that would follow the user thruout the site and then if
the person reaches a conversion goal I can call on a coldfusion
page to update my database?
Did I just make any sense whatsoever?Would putting your conversion program into a cfc so it's
available as a web service help? -
DB2 timestamp to oracle timestamp conversion
Does any one know how to convert Db2 timestamp into oracle timestamp.
From DB2 we are getting timestamp in this format (2000-03-06-16.02.19.074474) (26 bytes).
I want to insert this into oracle thru owb into oracle table with column type timestamp.
Does anyone know the procedure for this type of conversion
Thanks in advance..Hi,
Try a migration tool at www.ispirer.com/chyfo.html
It provides you the fastest, the easiest and the most powerful way to migrate
DB2 database into Oracle.
It works in conjunction with Oracle SQL Loader. The tool creates text files (moving of LOBs are fully supported), generates
CREATE TABLE scripts for Oracle and control files for SQL Loader.
The tool has a lot of other features.
Best regards, Dmitry.
null
Maybe you are looking for
-
In form1 constructor: fileDownloadRadar();backgroundWorker2.RunWorkerAsync(); First i'm downloading one image from another source using WebClient in form1: private void fileDownloadRadar() if (Client.IsBusy == true) Client.CancelAsync(); else Client.
-
Satellite A500 - Upgrading from Vista to Windows 7 error
I'm trying to upgrade my Vista Home Premium to Windows 7 Home Premium via the Toshiba Upgrade Assistance so it will automatically download some Toshiba's utilites and software. At the start of launching it, an error message "This model does not suppo
-
Does anybody here know whether the copy of Window XP Pro that you get when you buy Virtual PC with XP Pro is the Full version or an OEM? Also, does Windows XP come on a seperate disc? TIA, David
-
Hi there, Since there are so many API's to work with XML, and being these Sun specifications, what are the really differences between them? And when should I use one instead of the other. Many Thanks, MeTitus
-
Trouble using Photoshop CC with Surface Tablet with Pen input.
I installed Creative Cloud in my Windows Surface Pro 8.1 Tablet. The software works well, but I am unable to use Photoshop with the pen input device provided with the tablet. I'm trying to draw freehand using the Pencil command in Photoshop, but the