SQL & PL/SQL :: How To Convert DD-MON-YY HH24:MI:SS
May 4, 2010
I pretty new on Oracle and I'm facing with a issue. I don't know how to convert 'DD-MON-YY HH24:MI:SS' to 'DD-MON-YY Seconds'.So '29-APR-2010 16:32:23' will be ' 29-APR-2010 59543' (16*3600+32*60+23) Is this possible ?
I wrote the one query which is return the following output..
Query:
SELECT RMC_N_ID,NVL(DISCOUNT_N_ID,NULL) AS DISCOUNT_N_ID,NVL(NULL,'') AS LOADINGS_N_ID,NVL(NULL,'') AS WARCOMB_N_ID,NVL(NULL,'') AS ENDORSECOMB_N_ID FROM UWRMC_DISCOUNT WHERE RMC_N_ID =224 AND DISCOUNT_N_ID IS NOT NULL UNION SELECT RMC_N_ID,NVL(NULL,'') AS DISCOUNT_N_ID,NVL(LOADING_N_ID,NULL) AS LOADING_N_ID ,NVL(NULL,'') AS WARCOMB_N_ID,NVL(NULL,'') AS ENDORSECOMB_N_ID FROM UWRMC_LOADING WHERE RMC_N_ID =224 UNION SELECT RMC_N_ID,NVL(NULL,'') AS DISCOUNT_N_ID,NVL(NULL,NULL) AS LOADING_N_ID ,WARCOMB_N_ID,NVL(NULL,'') AS ENDORSECOMB_N_ID FROM UWRMC_WARCOMB WHERE RMC_N_ID =224 UNION SELECT RMC_N_ID,NVL(NULL,'') AS DISCOUNT_N_ID,NVL(NULL,NULL) AS LOADING_N_ID ,NVL(NULL,'') AS WARCOMB_N_ID, ENDORSECOMB_N_ID FROM UWRMC_ENDORSECOMB WHERE RMC_N_ID =224
my data looks like:- Ename Job salary ----- ----- ------- A manager 10000 B clerk 60000 C assistant 30000 A manager 50000 B clerk 20000 D accountant 40000
I want the result while select all data should look like:-
A B C D manager clerk assistant accountant 10000 60000 30000 40000 50000 20000
i have a problem ! i have developed my database in oracle 10forms with 10 database! Now i want to convert my 10G forms into 6i as connected with 10G database! how i will configure 10gdatabase with 6i forms and is it possible to convert my 10g forms into 6i forms?
Actually I got a data in hex values and i want to convert it to datetime format. But before i convert the hex value into datetime format, i must convert the hex values into decimal val first for each 2 digits of hex values. This is an example of the input data:-
This is input data in hex value:- STARTTIME : 080b1317021a
This is decimal value after convert from hex to decimal:- STARTTIME : 081119230226
My problem is how could i convert hex to decimal in oracle? Below are my coding:-
case when substr(LOAD_NGNSM.STARTTIME, 1, 2) not between '00' and '99' or substr(LOAD_NGNSM.STARTTIME, 3, 2) not between '01' and '12' or substr(LOAD_NGNSM.STARTTIME, 5, 2) not between '01' and '31' or substr(LOAD_NGNSM.STARTTIME, 7, 2) not between '00' and '59' or substr(LOAD_NGNSM.STARTTIME, 9, 2) not between '00' and '59' [code]....
I tried creating the required view using 'CASE' statement and group by but its returning multiple rows.
select case when PropertyID=1 then VALUE end as Attrib1, case when PropertyID=2 then ValueID end as Attrib2, case when PropertyID=3 then ValueID end as Attrib3 case when PropertyID=4 then ValueID end as Attrib4 from ( select Phone, PropertyID, ValueID,Value from PropertyValue group by Phone, PropertyID, ValueID,Value )
I have to change some queries from SQL to Oracle but I couldn't convert these queries because they use some system tables in SQL that I don't know the equivalent Oracle tables. Following are SQL Queries
1. SELECT name, xtype FROM sysobjects WHERE xtype IN('U', 'V') AND name <> 'dtProperties' AND objectproperty(id, 'IsMSShipped') = 0 ORDER BY name
2. SELECT tS.name FROM sysobjects AS tS WHERE (tS.name IN (SELECT name FROM sysobjects WHERE xtype = 'U') AND xtype ='U') OR (tS.name IN (SELECT name FROM sysobjects WHERE xtype = 'V') AND xtype ='V')
3. SELECT o.name as TableName, c.name as FieldName, c.colid as Field_Ordinal, t.name as FieldType, c.length as FieldLength, c.prec as FieldPrecision, c.scale as FieldScale, c.isnullable, c.iscomputed, CASE WHEN c.status & 0x80 > 0 THEN 1 ELSE 0 END AS isidentity, columnproperty(o.id, c.name, 'IsRowGuidCol') as isrowguidcol FROM (sysobjects o JOIN syscolumns c ON o.id = c.id) JOIN systypes t On c.xtype = t.xtype WHERE o.xtype IN ('U', 'V') AND (t.xtype = t.xusertype)
I want to convert the time part of each rows to number of second in different column. so for the 1st rows it is 09:18:00.000 that means 9hour and 18 min = 9*60*60+18*60.
I have a program that was developed in Forms 6i.Actually, this program:
- reads a table with a Blob column that contains a MS Word format Document. - the document needs to be convert , then the program changes some variables that are wildcards.
In forms 6i I use a column with datatype Ole and the flowing procedure that read value from database:
PROCEDURE Pr_Abre_Contrato (pContrato In Contrato.Cont_Numero%Type, pQuery in Varchar2 ) Is Workbook OLE2.OBJ_TYPE; Application OLE2.OBJ_TYPE; MyDocuments ole2.obj_type; Args ole2.obj_type; vWhere Varchar2(200); [code]....
Now, I need to convert this program to forms10g. I opened the TAR in metalink and the Support said that exec_verb can not be used and it doesn't have another one to replace.
Attribute_namePrimary Seconday DNS 204.109.167.1204.109.167.2 DNS 204.109.167.2204.109.167.3 NAT 138.20.37.136138.20.37.137 NAT 138.20.20.116138.20.20.117
oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production PL/SQL Release 11.1.0.6.0 - Production "CORE 11.1.0.6.0 Production"
I am trying to write a function that accepts LOCAL DATE, LOCAL TIME, LOCAL TIME ZONE, COUNTRY CODE as inputs, and UTC DATE, UTC TIME as outputs. LOCAL DATE, LOCAL TIME, LOCAL TIME ZONE has to be of DATETIME datatype, and COUNTRY_CODE of VARCHAR2(3).
I currently have a table with a VARCHAR column which is used to store notes. Currently the notes read something like 'Verified 01/01/2012'. I am trying to convert it to a date column so I can run reports using the date (select between dates etc).
I have tried with the substr function but since the records are all different doesn't really work. (plus that doesn't make it a date so not sure it would work for searching).
I know this question has been asked several times. but i am starting out and i am struggling to get my head aroung it.I would like to convert datetime column of Oracle source(RPT.SHIPMENT_VW) to date while loading to sql Here is my
SELECT SHIPMENT_NBR,RECEIVED_DATE_TIME, RCVD_AT_DATE_GMT_FK FROM RPT.SHIPMENT_VW where WHERE RECEIVED_DATE_TIME = TO_DATE(TO_CHAR(:fromdate, 'DD/MM/YYYY')) here RECEIVED_DATE_TIME is in 'DD/MM/YY hh:mi:si' fromat which, i want to convert to 'DD/MM/YY' the above code throwing an error ORA:01843 not a valid month
if I use where clause like:WHERE (RECEIVED_DATE_TIME = TO_DATE(TO_CHAR(:fromdate, 'DD/MM/YYYY'), 'DD/MM/YY'))then its not retrieving any data