Convert varchar to date in BO Universe with Substring and instring function
to_date(substr(xxxx_v.e_details,instr(xxxx_v.e_details,'|',1,2)+1,9),'DD-MM-YYYY') In the universe while defining the object as date i was facing probs can any body help me out. the column xxxx_e_details is having the datatype varchar in database and the third string is date while i was creating the date object in the universe with the above syntax it was getting the error
The data in this obect is like this xxxx_v.e_details -> wwww|eeee|MM-DD-YY|
Edited by: mohammed kashif on Mar 31, 2011 11:47 AM
i am getting the data but it is in the format 01-03-0201. The year format for 2010 is populating as 0201. i am not able to think whether it is due to instring function which is reading data like this. Need suggestion from experts.............
Similar Messages
-
Hi
im trying to convert varchar to date.
So, i used To_date ( cilumn, 'DD-MM-YYYY') , Since i have to order the out put in Decending Order i used the same convertion function with Order by clause.
The problem is ... the out put is not ordered,
<sql>
select date_created
from
select distinct
to_date(created_date,'DD-MM-YYYY') as date_created
from schedule_backup
order by date_created desc
<sql>
out put is
=================
DATE_CREA
26-NOV-09
23-NOV-09
19-NOV-09
16-NOV-09
11-NOV-09
04-NOV-09
30-OCT-09
11-SEP-09
04-MAR-10
01-MAR-10
25-FEB-10
DATE_CREA
22-FEB-10
17-FEB-10
15-FEB-10
11-FEB-10
09-FEB-10
03-FEB-10
27-JAN-10
20-JAN-10
15-JAN-10
04-JAN-10
thanks
rajHi, Raj,
When you store dates in a VARCHAR2 column, you're asking for touble, so it seems that everything is working according to plan.
Even aside from that, your query works perfectly for me.
In the output you posted, the order is correct within each year, and you're only showing 2 digits of the year. Are you sure the centuries are right in the schedule_backup table? Perhaps everything that was supposed to be '2010' got enetereed as '1910' or '0010'.
Post some sample data (CREATE TABLE and INSERT statements) that gets the wrong results with your query.
For example:
CREATE TABLE schedule_backup
( created_date VARCHAR2 (10)
INSERT INTO schedule_backup (created_date) VALUES ('11-11-2009');
INSERT INTO schedule_backup (created_date) VALUES ('04-11-2009');
INSERT INTO schedule_backup (created_date) VALUES ('30-10-2009');
INSERT INTO schedule_backup (created_date) VALUES ('11-09-2009');
INSERT INTO schedule_backup (created_date) VALUES ('04-03-2010');
COMMIT; -
How to convert varchar to date datatype while insert or update in table
Hai All
I need to convert to varchar to date.
I have two Tables T1,T2
T1 Structure
Code varchar
Time varchar
Date varchar
T2 Structure
Empname var
Empcode var
Intime date
Outtime date
Intrin date
Introut date
Att_date
Now i need to move Time form T1 to T2 Intime,outtime,intrin,introut according some condition
So now i need to convert Varchar to Date while insert or update
I have tried something
Insert into T1 (code,intime,att_date)values
(code,To_date(Date||time,'dd-mon-yyyy hh24mi'),att_date);
OR While update
Update T2 set Outtime=To_date(Date||time,'dd-mon-yyyy hh24mi') where...
I got an error Ora-01861
Regards
Srikkanth.MYou didn't show any example of your date or time values, butyou might need to add a space between them, like
To_date(Date || ' ' || time,'dd-mon-yyyy hh24mi') -
Convert VARCHAR to date - don't know format in advance
Hi,
If I want to convert varchar to date, but I don't kniow the format of the varchar in advance. For example, it may be '20-MAY-99', '2009-01-10 10:01:00', but it is not known in advance. How can I convert it to date?
Many thanksYou'll have to define a hierarchy of date formats to try. There are some strings that map to many different valid dates depending on the format. The string '01/02/03' might translate to January 2, 2003, January 2, 1903, February 1, 2003, February 1, 1903, February 3, 2001, February 3, 1901, etc.
Assuming you define a hierarchy of formats, you can write a function that tries each format in turn, i.e.
CREATE FUNCTION my_to_date( p_string IN VARCHAR2 )
RETURN DATE
IS
l_date_variable DATE;
BEGIN
l_date_variable := to_date( p_string, <<format 1>> );
return l_date_variable;
EXCEPTION
WHEN OTHERS THEN
BEGIN
l_date_variable := to_date( p_string, <<format 2>> );
return l_date_variable;
EXCEPTION
WHEN OTHERS THEN
END;You'll need to define the N date formats to try and the order in which to try them.
Justin -
Problem with tpcall and tpgetrply functions
Hi,
I have a problem with tpcall() and tpgetrply() functions.
In this example (invoke tpcall()):
FBFR32 *buf;
FLDLEN32 buflen;
buf = a_buffer.getBuffer(); /* getBuffer() returns FBFR32* */
buflen = a_buffer.getLongitud();
/* at this point: buf == a_buffer.getBuffer() */
if (tpcall(a_contenedor.getServname(),
(char*)a_contenedor.getBufferPeticion()->getBuffer(),
a_contenedor.getBufferPeticion()->getLongitud(),
(char**)&buf,
(long*)&buflen,
0) == -1)
if (tperrno != TPESVCFAIL)
LANZAR_EXCEPCION(CADENA_WHAT_SB,
"Error en funcion Execute(), llamada tpcall()",
tpstrerror(tperrno))
/* at this point: buf != a_buffer.getBuffer() */
tpcall() function change the memory address of buf. What is the problem? Is wrong my code? Is a problem with tuxedo version?
My tuxedo version is:
tmadmin -vINFO: BEA Tuxedo, Version 8.0, 32-bit, Patch Level 306
INFO: Serial #: 650522264137-773290431251, Expiration NONE, Maxusers 150
INFO: Licensed to: Telefonica Moviles Espa?a, S.A.
INFO: 56-bit Encryption Package
Thanks,
ANTONIO.There's nothing wrong with your code or tuxedo. tpcall (and tpgetrply) can change the address of the return buffer if it needs to allocate more memory to hold the data. This is the reason why you pass a pointer to the buffer as the output buffer parameter to tpcall and tpreturn. Everything is working as expected.
-
Is it possible to create a tree with drag-and-drop functionality using ajax
I saw these samples;
Scott Spendolini's AJAX Select List Demo
http://htmldb.oracle.com/pls/otn/f?p=33867:1:10730556242433798443
Building an Ajax Memory Tree by Scott Spendolini
http://www.oracle.com/technology/pub/articles/spendolini-tree.html
Carl Backstrom ApEx-AJAX & DHTML examples;
http://htmldb.oracle.com/pls/otn/f?p=11933:5:8901671725714285254
Do you think is it possible to create a tree with drag-and-drop functionality using ajax and apex like this sample; http://www.scbr.com/docs/products/dhtmlxTree/
Thank you,
Kind regards.
TonguçHello,
Sure you can build it, I just don't think anyone has, you could also use their solution as well in an APEX page it's just a matter of integration.
Carl -
Need complex query with joins and AGGREGATE functions.
Hello Everyone ;
Good Morning to all ;
I have 3 tables with 2 lakhs record. I need to check query performance.. How CBO rewrites my query in materialized view ?
I want to make complex join with AGGREGATE FUNCTION.
my table details
SQL> select from tab;*
TNAME TABTYPE CLUSTERID
DEPT TABLE
PAYROLL TABLE
EMP TABLE
SQL> desc emp
Name
EID
ENAME
EDOB
EGENDER
EQUAL
EGRADUATION
EDESIGNATION
ELEVEL
EDOMAIN_ID
EMOB_NO
SQL> desc dept
Name
EID
DNAME
DMANAGER
DCONTACT_NO
DPROJ_NAME
SQL> desc payroll
Name
EID
PF_NO
SAL_ACC_NO
SALARY
BONUS
I want to make complex query with joins and AGGREGATE functions.
Dept names are : IT , ITES , Accounts , Mgmt , Hr
GRADUATIONS are : Engineering , Arts , Accounts , business_applications
I want to select records who are working in IT and ITES and graduation should be "Engineering"
salary > 20000 and < = 22800 and bonus > 1000 and <= 1999 with count for males and females Separately ;
Please help me to make a such complex query with joins ..
Thanks in advance ..
Edited by: 969352 on May 25, 2013 11:34 AM969352 wrote:
why do you avoid providing requested & NEEDED details?I do NOT understand what do you expect ?
My Goal is :
1. When executing my own query i need to check expalin plan.please proceed to do so
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9010.htm#SQLRF01601
2. IF i enable query rewrite option .. i want to check explain plan ( how optimizer rewrites my query ) ? please proceed to do so
http://docs.oracle.com/cd/E11882_01/server.112/e16638/ex_plan.htm#PFGRF009
3. My only aim is QUERY PERFORMANCE with QUERY REWRITE clause in materialized view.It is an admirable goal.
Best Wishes on your quest for performance improvements. -
Convert varchar(20) date to date that looks like mm/dd/yyyy
Good afternoon,
I am a total novice at SQL and have been tasked to change a varchar(20) date column (shows up as m/dd/yy) to show up as mm/dd/yyyy. I've looked at the previous posts, but being a novice, it's difficult to wade through the non-applicable stuff. The column
that needs to be changed is field2, but I'm not sure how to construct a statement to reflect my objective.
Thank you in advance.The sample uses a table variable. You can program it the same way for a table:
DECLARE @t TABLE (dt VARCHAR(20))
INSERT INTO @t
VALUES ('1/2/12')
,('3/10/10')
,('7/23/9')
,('aa')
,('12/31/99')
,('10/20/00')
,('10/20/01')
SET DATEFORMAT mdy
SELECT dt
,CONVERT(VARCHAR(10), CASE
WHEN isdate(dt) = 0
THEN NULL
ELSE cast(dt AS DATE)
END, 101) AS newDt
FROM @t;/******** TRY_CONVERT() method ************/
SELECT dt, newDt=CONVERT(varchar(10),TRY_CONVERT(date,dt),101) FROM @t;
GO
dt newDt
1/2/12 01/02/2012
3/10/10 03/10/2010
7/23/9 07/23/2009
aa NULL
12/31/99 12/31/1999
10/20/00 10/20/2000
10/20/01 10/20/2001
dt newDt
1/2/12 01/02/2012
3/10/10 03/10/2010
7/23/9 07/23/2009
aa NULL
12/31/99 12/31/1999
10/20/00 10/20/2000
10/20/01 10/20/2001
Starting with SQL Server 2012 you can use TRY_CONVERT().
You can start studying datetime functions here:
http://www.sqlusa.com/bestpractices/datetimeconversion/
Kalman Toth Database & OLAP Architect
T-SQL Scripts at sqlusa.com
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
Convert varchar to date in OBIEE-sql server database
Hi we have SQL server database,
and we need to convert varchar to to_date .
In OBIEE we use evaluate,cast etc on Oracle......Not sure about sql server..please helpi am usiing below formula in my reports-answer side:
Cast((case when "Job CV Fact"."Total Cv Sent" is not null then "DATE DIM".Date end)as Date)
below error is coming:
A general error has occurred. [nQSError: 46046] Datetime value 01/01/08 does not match the specified format. (HY000)
cast("DATE DIM".Date as date) the above error comes :) -
Estimated delivery dates for iPad 4 with wifi and cellular UK
I have ordered the new iPad 32gb With wifi and cellular data and on my account it just says late November. Is there any way to find out a more specific date as I am going away and want to take it with me?? Would I have to ring Apple and ask?
No one here will know
I doubt ringing will change anything as Apple
will update orders as soon as they can see supply to apply to the orders
You will find the number for UK on the order document -
Problem changing SQL data source at runtime with VB6 and CR XI
Hello All,
We have several VB6 programs using CR XI and are able to pass a DSN to change data source with Access DB that works just fine.
We are using similar code in another program to change the data source in an SQL DB and get an error... Failed to Open the Connection.
This is a sample of what works with Access but not SQL DB:
Dim crxApplication As New CRAXDRT.Application
Public Report As CRAXDRT.Report
Global DSN_STRING
DSN_STRING = "DSN = JC Crystal Reports"
Dim crxDatabaseTable As CRAXDRT.DatabaseTable
Set Report = crxApplication.OpenReport(App.Path & "\Test11.rpt", 1)
'change location of each table in report
For Each crxDatabaseTable In Report.Database.Tables
crxDatabaseTable.Location = DSN_STRING
Next crxDatabaseTable
FormCrystal.Show vbModal
We have tried other things from the web, still get error.
Any help would be greatly appreciated.
C ReidHi Carole,
When using SQL types you need more than just the DSN name. CR does keep the password in the report file and all SQL types are usually password protected.
Try this simple code:
First log onto the server:
rpt.database.LogOnServerEx("crdb_odbc.dll, pServerName, [pDatabaseName], [pUserID], [pPassword], [pServerType], [pConnectionString])
The ConnectionString is the complete line. Run in debug mode and display what the reprot is using and you can see the format it requires.
Once logged on now you can set the location for each table:
'report connection properties
With rpt.Database.Tables(1)
.ConnectionProperties("User ID").Value = "sa"
.ConnectionProperties("Password").Value = "YourPassword"
.ConnectionProperties("Data Source Name").Value = "Your DSN Name"
'.ConnectionProperties("Data Source Name").Value = "ServerName" ' can be used if specifying a new connection
.ConnectionProperties("Database").Value = "Northwind"
End With
Set rpt.Database.Tables(1).Location = "Northwind.dbo.CustOrderHist"
I'm only using one table so easy enough to create the loop or use for all...
Thank you
Don -
Ways to get data from the internet with XCode and Objective-C
Hey guys,
Thanks in advance for any help. I was simple wondering what the best ways are to get data from the internet to use in an application. For example, is it best to store the data in a MySQL database with PHP and then use C code and MySQL commands to get that data from my Mac app? Is JSON better? Any help would be awesome!
JoshWhat kind of data are you after?
Eric -
How to fix my converted files which come out unlegible mixed with letters and symbols?
how to fix my converted documents which look unlegible, mixed with numbers and symbols?
Suggest you first validate the code
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.sainttims.com%2F&charset=%28detect+auto matically%29&doctype=Inline&group=0
The Float drop issue on the News page could also be related to invalid code
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.sainttims.com%2Fnews.php&charset=%28det ect+automatically%29&doctype=Inline&group=0
Fix lots of similar odd code like
<p span class="BlueType">
which should read
<p><span class="BlueType">\
The code for the sidebar photos reads
<img src="images/photos/2012DOKSpringAssembly/Bishop-Susan-Boat.jpg" align="center" width="190" height="" />
where height="", IE seems to rendering them at a height of 0px (i.e. invisible). -
Help with sign and replacestr functions in SQL
I am trying this:
In a full name if the Middle Initial is null then add an additional space between the First name and last name else select the full name itself.
For to check for the spaces I am subtracting first occurrence of space - second occurrence of space using instr function
I have to use sign function to check for "-value", if the value is -ve then don't do any thing and if it is equal to 0 add one more space to the name.
But how can i use decode here to select the original column if sign is a negative value.
My sql:
IIF(SIGN(INSTR(o_full_name,' ')- (INSTR(o_full_name,' ',1,2)))=0,REPLACESTR(1,o_full_name,' ',' '))
gow can i use decode in place off IIFthis examples might help if the names are in separate columns.
SQL> create table telephone_list
2 (first_name varchar2(20),
3 middle_initial varchar2(2),
4 last_name varchar2(20));
Table created.
SQL> insert into telephone_list
2 values
3 ('Scott',null,'Tiger');
1 row created.
SQL> insert into telephone_list
2 values
3 ('John','T','Perl');
1 row created.
SQL> insert into telephone_list
2 values
3 ('Kim',null,'Molit');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from telephone_list;
FIRST_NAME MI LAST_NAME
Scott Tiger
John T Perl
Kim Molit
SQL> select decode(middle_initial,null,first_name||' '||last_name,
2 first_name||' '||middle_initial||' '||last_name)
3 full_name
4 from telephone_list;
FULL_NAME
Scott Tiger
John T Perl
Kim Molit
SQL> is the name in one column only? please post a sample data. thanks. -
Need advanced material on smartforms with each and every functionality.
Hi all,
I hav a basic material on smartforms i need a material with each and every application of smartforms and how abouts of the developing tips.Complete smart form material or link.
Remind you not the basic simple smartform material with advantages but in depth smartform applications is what i am looking for.
Points are waiting.
Regards,
Ravi K.hi
u can approach this link.
http://www.****************/Tutorials/Smartforms/SFMain.htm
Thanks,
Usha
Maybe you are looking for
-
Satellite M30-861: why can i not write to DVD?
Hi I bought Satellite M30-861 about 15 months ago and until now have only tried to burn CDs - no problem. Now I want to try to burn onto a DVD but it doesnt seem to be recognised (I tried drag n drop and also NERO). I can see on the drive unit that i
-
Import and directory synchronize problem
I'm having a problem importing new pictures into an existing file directory which appears in my Lightroom catalog. The photos import normally but show up as a new directory entry off the root of the Lightroom catalog. When I attempt to move/drag them
-
Hi guys I have a dynamic PDF form, which is 3 pages long. At the top of each page are text fields for the first and last name, along with the date. I'm wondering how I can allow these fields to be filled out only once, and display correctly at the to
-
TS1372 i have an error 1434? what does this mean?
i have an error 1434? what does this mean?
-
Terminal's "locate" Command Problem
Howdy, I was trying to locate a file that had been autosaved by MS Excel prior to a power outage... Not knowing where MS autosaved it's "stuff", I was using Terminal and the "locate" command to try to find the file and it's path, however it wouldn't