Between Dates SQL
Hi,
Can anyone help, I need to generate a pivot table using between two dates and a department. I am trying to acheive the following output:
JAN-04 FEB-05 MAR-04 APR-04 MAY-04 JUN-04 JUL-04 AUG-04 SEP-04 OCT-04 etc
DEPT 1 1 1 1 1
CF
IF 1 1 1 1 1
The SQL is displayed as below:
"PERSON_ID" "EFFECTIVE_START_DATE" "EFFECTIVE_END_DATE" "DEPT"
1182 12-JAN-04 07-MAY-04 CF
1182 17-JUN-04 31-DEC-12 IF
Can anyone help with acheiving the above pivot table based on the SQL results above
Thanks
Hi,
sliderrules wrote:
Hi,
Thanks for your help, just wanted to confirm should I be creating a lookup table called months containing the months to display in the pivot table. That depends on what you want to do. You can either have a real table, or you can generate a result set in a WITH clause, like I did. Either way, you have to have a table (or result set) that has one row for each column that you want in your pivoted output.
I have posted below some scripts to generate the table:
>
CREATE TABLE EMPLOYEES(
PERSON_ID NUMBER,
DEPT VARCHAR2(10),
EFFECTIVE_START_DATE DATE,
EFFECTIVE_END_DATE DATE);
INSERT INTO EMPLOYEES VALUES(1182, 'CF', '12-JAN-2004', '07-MAY-2004');
INSERT INTO EMPLOYEES VALUES(1182, 'IF', '12-JUN-2004', '07-DEC-2004');
INSERT INTO EMPLOYEES VALUES(1183, 'BF', '01-JAN-2005', '12-JUL-2005');Effective_start_date and effective_end_date are DATEs. Don't try to put VARCHAR2 values into DATE columns. Use TO_DATE to convert strings into DATEs.
>
I would like to acheive the following:
JAN04 FEB-04 MAR-04 APR-04 MAY-04 JUN-04 JUL-04 AUG-04 SEP-04 OCT-04 NOV-04 DEC-04 JAN-05 FEB-05 MAR-05 APR-05 JUN-05 JUL-05
DEPT
CF 1 1 1 1 1
IF 1 1 1 1 1 1 1
BF 1 1 1 1 1 1
Apologies if the pivot table is not readable, I am new to OTN and not sure how to format the output with tagsType these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
It would help a lot to know what you are trying to do.
Is the jan_04 month column supposed to show the number of rows in which the range effective_start_date to effective_end_date includes at least some part (if not all) of January, 2004? If so, change the join conditions that I posted earlier:WITH all_months AS
SELECT LEVEL AS month_num
, ADD_MONTHS (DATE '2004-01-01', LEVEL - 1) AS month_begin_date
, ADD_MONTHS (DATE '2004-01-01', LEVEL ) AS next_month_begin_date
FROM dual
CONNECT BY LEVEL <= 12 -- Or whatever value you want
SELECT dept
, COUNT (CASE WHEN m.month_num = 1 THEN 1 END) AS jan_04
, COUNT (CASE WHEN m.month_num = 2 THEN 1 END) AS feb_04
, COUNT (CASE WHEN m.month_num = 3 THEN 1 END) AS mar_04
FROM all_months m
JOIN employees e ON e.effective_start_date < m.next_month_begin_date
AND e.effective_end_date >= m.month_begin_date
GROUP BY e.dept
ORDER BY e.dept
Similar Messages
-
I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
[ABCTABLE]
ABCORDER
ABCPART
ABCSERIAL
ABCDATE
[ZYXTABLE]
XYZORDER
XYZPART
XYZSERIAL
XYZDATE1
XYZDATE2Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
on this computer. There are no "Null" fields in either of the tables.
This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
[MSORDR]
MSORDER
MSPART
MSSERIAL
MSOPNDATE
11111111
4444444
55555
2/4/2015
22222222
6666666
11111
1/6/2015
33333333
6666666
11111
3/5/2015
This table has one order for every part number and every serial number.
[GLORDR]
GLORDER
GLPART
GLSERIAL
GLSTARTDATE
GLENDDATE
ABC11111
444444
55555
1/2/2015
4/4/2015
ABC22222
666666
11111
1/5/2015
4/10/2015
AAA11111
555555
22222
3/2/2015
4/10/2015
Post Query table
GLORDER
MSORDER
GLSTARTDATE
GLENDDATE
MSOPNDATE
ABC11111
11111111
1/2/2015
4/4/2015
2/4/2015
ABC22222
22222222
1/5/2015
4/10/2015
1/6/2015
ABC22222
33333333
1/5/2015
4/10/2015
3/5/2015
This is the SQL minus the between date join.
SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART); -
What are the Major and Minor Diffs between oracle,sql server,MSAccess
Hi all,
Can any one explain or send me all the diff between
oracle ,sql server,access..like how much data can each
support,...
ThanksDear sir,
here it is.
http://www.oracle.com/database/product_editions.html -
Frequently transfering databases between MS SQL and Oracle
Hello all,
I am looking for a solution to easily, efficiently and be able to migrate/transfer databases between MS SQL and Oracle frequently.
I need to be able to replicate a databases on Ms SQL and Oracle for testing purposes. I will need to do this on frequent basis - almost once a week.
Please suggest what would be the best way.
Thanks in advance.Hi Justin,
You have guessed it right to a great extend. Yes dont actually need to develop, rather need to test an application that supports SQL and Oracle databases. Now when testing the application its obviously vital to create proper systematic test data. This usually takes a lot of time and effort from the testing team/team-member. So, yes what I need to do is create the test data on one database(may it be SQL or Oracle) and migrate/transfer the data into the database on another server( ie. SQL to Oracle or Oracle to SQL).
So,
Are you developing a product that works against both SQL Server and Oracle and trying to synchonize development efforts?Yes, thats correct to extend, I need to test an application against both the servers, as it supports both types of databases, and try to reduce the test setup efforts (literally double the amount) that go in after manual creating same data on each type of database.
Are you trying to replicate structural changes between systems?I am not 100% sure, what you mean by this. But whats important and enough for me is to replicate the data. It would not be a lot of work to run the scripts and create empty schema objects.
Are you trying to replicate data changes between systems? The fact that you're only doing this weekly suggests that you're not working in a traditional replication environment.Yes, again as I mentioned above. It would be sufficient for me to just get a copy of the initial dataset. And then replicating changes to it would not be that important. However, if I can achieve a solution to this, I can by all means create a new database on the one server (SQL or Oracle) and take the data-set of the most recent/correct changes and replicate it on the other type of server as and when needed.
No - this is not a traditional replicating environment. I say weekly, because it is usually once in a week or forthnight that someone from the team will need to spent time to manually copy the test-data onto the another type of server in order to run the same testcases on two types of servers.
How do you handle conflicts (i.e. if I modify a row in both systems, which modification wins)? This is not really a problem in my scenario, as I only need to be able to transfer the data across to the different server and forget about the two databases actually being in-sync.
I have also, looked at DTS for a possible solution on SQL, however it seems highly un-realistic, having to map somewhere like 250 tables from the a drop-down list, only because the two database servers use different cases to represent tables internals. So, table 'Table' in my application's SQL database is called 'TABLE' is my applications Oracle database. DTS is highly inefficient in dealing with this. Also, having 250 tables move makes this a bit of a pain.
Thank you Justin for your response; I highly appreciate your inputs.
Regards, Nisarg -
Connection between two SQL Azure Databases
We have a requirement to move data (partial data in a table based on policy conditions) between two SQL Azure Databases. Want to know the best possible way to do this.
We are not looking at Data Sync Framework - as this is only a Preview version and we have to use this in an ongoing basis in Production and the volume of data is quite high.
The option that we have currently is to use an on premise stored procedure - that will have two link servers to the source and target SQL Azure Databases and do the data movement in one transaction.
Are there any other better options to do this ? Any pointers will be helpful.Hi Kothai Ramanathan,
According to your description, if you just want to moving part of the data from a huge table between two different SQL Server database, you can use
SQL Server replication to sync the part of data via articles. However, in SQL Azure database, it does not support SQL Server replication, if you want to migrate database, as other post, you
can use Data-Tier Application Import and Export or other ways.
In addition, for just moving the part of data, you can also create two Linked Servers between local SQL Server database and two different SQL azure database. For example, you can get the changed data from the first Linked
Server and saved the data to Local database, then insert these data to the other azure database via the second Linked Server.
For more information, see:
http://azure.microsoft.com/blog/2012/09/19/announcing-updates-to-windows-azure-sql-database/
http://blogs.msdn.com/b/sqlcat/archive/2011/03/08/linked-servers-to-sql-azure.aspx
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
I need to know how i can find difference between date
like Joining date: 01-jan-2009 Today 10-jan-2010 result will be "1 year 10 days"
I need it in Oracle forms 6i. plz help me...Hi,
In oracle forms you can use
RESULT :=
TRUNC ((:date2 - :date1 + 1) / 365)
|| ' year and '
|| MOD (:date2 - :date1 + 1, 365)
|| ' days';
in sql you can use
SELECT TRUNC ((:date2 - :date1 + 1) / 365)
|| ' year and '
|| MOD (:date2 - :date1 + 1, 365)
|| ' days'
FROM DUAL; -
Require the list of dates exist between dates
in 10g database i can execute the below query
Iam having a table sdate
pk startdate enddate des1
1 1/1/2010 1/3/2010 xxxxxxxxc
2 1/5/2010 1/20/2010 abc
i need list of dates between startdate and enddate, so i created this query
SELECT DISTINCT d, des1
FROM (SELECT pk, s.startdate + LEVEL - 1 d, des1
FROM sdate s
CONNECT BY LEVEL <= (SELECT enddate - startdate + 1 FROM sdate y WHERE s.pk = y.pk))
ORDER BY d, des1
but in 9i database if i execute the same above query iam getting
ORA-01473: cannot have subqueries in CONNECT BY clause
**is there any other way to view list of dates for the given range of date**SQL>WITH sdate AS
2 (
3 SELECT 1 AS pk, DATE '2010-1-1' AS startdate, DATE '2010-1-3' AS enddate, 'xxxxxxxxxxxcxx' AS des1
4 FROM DUAL
5 UNION ALL
6 SELECT 2 AS pk, DATE '2010-1-5', DATE '2010-1-20', 'abx' AS des1
7 FROM DUAL)
8 SELECT startdate + d - 1, des1
9 FROM (SELECT ROWNUM AS d
10 FROM (SELECT MAX(enddate - startdate) + 1 AS maxrange
11 FROM sdate)
12 CONNECT BY LEVEL <= maxrange),
13 sdate
14 WHERE d <= enddate - startdate + 1;
STARTDAT DES1
01.01.10 xxxxxxxxxxxcxx
02.01.10 xxxxxxxxxxxcxx
03.01.10 xxxxxxxxxxxcxx
05.01.10 abx
06.01.10 abx
07.01.10 abx
08.01.10 abx
09.01.10 abx
10.01.10 abx
11.01.10 abx
12.01.10 abx
13.01.10 abx
14.01.10 abx
15.01.10 abx
16.01.10 abx
17.01.10 abx
18.01.10 abx
19.01.10 abx
20.01.10 abx
19 rows selected.
Elapsed: 00:00:00.07Urs
Edited by: metzguar on 09.07.2010 14:36 -
Hi,
Can any body help to write the query between dates in QAF.
i have writen like this but its is not working
whereClause.append(" OT_DATE between :");
// whereClause.append(++bindCount);
whereClause.append(fromDate);
// whereClause.append(++bindCount);
whereClause.append(" AND :");
whereClause.append(toDate);
ThanxVenkat, u can either use toDate() function in ur sql or use java.sql.Date to convert ur string into date.
Secondly parameters should be passed through whereclauseparams,like
java.sql.Date javaSqlDate =
transaction.getOANLSServices().stringToDate(submitedDateString);
whereClause.append("DATE_COLUMN_NAME = :1");
setWhereClauseParams(0,javaSqlDate);
--Mukul -
Does anyone know how to determine the
number of weekdays between two dates. Does
an Oracle function already exist. I don't want weekends to be included.
Thanks.=========
Abstract:
=========
The function in the script below will accept two date values and return the
number of business days between the two.
=============
Requirements:
=============
CREATE PROCEDURE
===============
Version Testing
===============
This script has been tested on Oracle Versions 7.3.4.X - 8.1.6.XX.
=======
Script:
=======
----------- cut ---------------------- cut -------------- cut --------------
SET ECHO off
REM NAME: TFSBSDAY.SQL
REM USAGE:"@path/tfsbsday"
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM CREATE PROCEDURE
REM ------------------------------------------------------------------------
REM PURPOSE:
REM The function created by this script will reutrn the number of
REM business days between two dates.
REM ------------------------------------------------------------------------
REM EXAMPLE:
REM SQL> @dates.sql
REM
REM Function created.
REM
REM SQL> select num_Business_Days('20-jun-95','28-jun-95') "Business
REM Days" from dual;
REM
REM Business Days
REM
REM -------------
REM 5
REM ------------------------------------------------------------------------
REM DISCLAIMER:
REM This script is provided for educational purposes only. It is NOT
REM supported by Oracle World Wide Technical Support.
REM The script has been tested and appears to work as intended.
REM You should always run new scripts on a test instance initially.
REM ------------------------------------------------------------------------
REM Main text of script follows:
create or replace function
num_Business_Days(start_date in date, end_date in date)
return number is
currdate date := start_date; /* holds the next date */
theDay varchar2(10);/* day of the week for currdate */
countBusiness number := 0; /* counter for business days */
begin
/* start date must be earlier than end date */
if end_date - start_date <= 0 then
return (0);
end if;
loop
/* go to the next day */
currdate := to_date(currdate+1);
/* finished if end_date is reached */
exit when currdate = end_date;
/* what day of the week is it? */
select to_char(currdate,'fmDay') into theDay from dual;
/* count it only if it is a weekday */
if theDay <> 'Saturday' and theDay <> 'Sunday' then
countBusiness := countBusiness + 1;
end if;
end loop;
return (countBusiness);
end;
----------- cut ---------------------- cut -------------- cut --------------
=========
Examples:
=========
Connected to:
Oracle8i Enterprise Edition Release 8.1.5.1.0 - Production
With the Partitioning and Java options
PL/SQL Release 8.1.5.1.0 - Production
SQL> @TFSBSDAY.sql
Function created.
SQL> select num_Business_Days('20-july-00','28-july-00')"Business Days" from dual;
Return...
Business Days
5
1 row selected.
null -
Hi Gurus,
Can anyone tell me the difference between "Data replication", "Data Cloning", "Data duplication" and "Data Migration". I have gone through Google but doesn't find any appropriate answer for that where I can find the difference.
It would be highly appreciated if you give me a link for all and give me some point out.
Thanks & Regards
Nimai KarmakarHere is how I see the terms used and understood by most folks
"Data replication"
This is the keeping the same data in sync in 2 different databases. Replication is the process of keeping data in sync between 2 environments/databases and not limited to Oracle to Oracle, it could be Oracle to MySQL to be kept in sync, MySQL to Oracle, Oracle to SQL Server, SQL Server to Oracle. The purpose of keeping data in sync can vary, but that is basic description of what it is.
"Data Cloning"
Make a copy of the data/database from one database environment to another, like for example taking production database and cloning the database to a pre-production database/environment for testing. Coning term is used more when copying a database not just data, but the whole database so typically you hear the reference "Database Cloning", but data cloning is basically the making a copy of the data from one place to another. Sometimes Cloning and Duplicating are used in the same way by folks as the basic end result is the same you are making a copy of the data to someplace else.
"Data duplication"
This is typically term when duplicating the data from one environment to another for a particular purpose, a lot of folks use "Data/Database Cloning" and "Data Duplication" in the same context, meaning they use them to mean the same thing, but I see more difference in the terms so when they are different Data Duplication is done when combining 2 databases to 1 therefore you can not clone the 2 databases into one so this term would be used more in those circumstances.
"Data Migration"
Moving data from one location/database to another location database, for example moving from MySQL to Oracle you would do a data migration from MySQL to Oracle as you are moving the data from MySQL to Oracle and going to leave it in Oracle. You could also be migrating to from Oracle 10g environment to a new Oracle 11g environment, therefore "Migration" is typically used when referring to moving the data from one environment to another and the source and target are different in location, database vendor, database version.
These are very simple ways of looking at the terms from my experience on how they are used. -
Differences between ANSI SQL and Oracle 8/9
Hallo,
i'm looking for good online texts or books concerning the problem "Differences between ANSI SQL and different database implementations (ORACLE, Informix, MySQL...)" I want to check a program written in C (with ESQL) that works with an Informix-DB. In this code i want to find code that is specific to the Informix-DB. I want to change the database, so all the code should be independent from a DB. Does anybody know texts or books concerning this problem?
thx
Marco SeumBasically there is syntax difference between both of them.
Lets say i want to join two table EMP and DEPT based on DEPTNO.
With Oracle SQL format its like this.
select e.*
from emp e, dept d
where e.deptno = d.deptnoHere the joining condition goes in the WHERE clause.
With ANSI SQL format its like this.
select e.*
from emp e
join dept d
on e.deptno = d.deptnoHere the join condition is mentioned separately and not in WHERE clause.
Oracle supports ANSI SQL starting from 9i version.
You can read more about the syntax difference Here -
What is difference between data base structure and stucure in program
what is difference between data base structure and stucure declared in program level . can explain cleary if knows
Hi,
Data base structure is global decalaration you can reffer this structure in any of your developments, when ever you cahange this structure the changes automatically will get updated in all the programs.
coming to structures in program it is local to your program only, if you want to change the structure again you have to open the program and do the necessary changes.
Reward if useful.
Thanks,
Sreeram. -
Returne between dates in case when
i want to return between dates values on case when clauses on where clauses
like
and
(case
when (cc.segment3 NOT like '4%' and cc.segment3 NOT like '5%')
then (between to_date('01/07/2012','dd/mm/rrrr') and to_date('31/07/2012','dd/mm/rrrr'))
when (cc.segment3 like '4%' or cc.segment3 like '5%')
then (between to_date('01/07/2012','dd/mm/rrrr') and to_date('31/07/2012','dd/mm/rrrr'))
end) h.default_effective_date
the problem is in the = operator but i don't know haw to use this
any help??ok here is the full coad
select
DECODE(SUBSTR (CC.segment1, 1, 1), 'J', 'OFFSHORE', 'I', 'OFFSHORE','IN COUNTRY')branch_nature,
decode(cc.segment1,'A6260','Head Office','Branches') branch_type,
cc.segment1,
decode (h.currency_code,'EGP','mahly','agnaby') currency_code ,
cc.segment3,
t.description,
CASE
when h.currency_code in('EGP') then sum(l.entered_cr)
else 0
end entered_cr,--sum(l.entered_cr) entered_cr,
CASE
when h.currency_code in('EGP') then sum(l.entered_dr)
else 0
end entered_dr, --sum(l.entered_dr) entered_dr,
CASE
when h.currency_code NOT in('EGP') then sum(l.accounted_cr)
else 0
end accounted_Dr,--0 accounted_Dr,
CASE
when h.currency_code NOT in('EGP') then sum(l.accounted_dr)
else 0
end accounted_cr --0 accounted_cr
from apps.gl_je_headers h,
apps.gl_je_lines L,
apps.gl_code_combinations cc,
apps.fnd_flex_values_tl t ,
applsys.fnd_user us,
apps.gl_je_batches b
where h.status = 'P'
and us.user_id = h.Created_by
--and h.currency_code in('EGP')
and l.je_header_id = h.je_header_id
and l.code_combination_id =cc.code_combination_id
and cc.segment3 = t.flex_value_meaning
and cc.segment3 in ('31000020','40505020')
and cc.segment1 in ('A5550','B0010')
-- and (DECODE(SUBSTR (CC.segment1, 1, 1), 'J', 'OFFSHORE', 'I', 'OFFSHORE','IN COUNTRY') =:P_branch_nature OR :P_branch_nature is NULL)
--and (decode(cc.segment1,'A6260','Head Office','Branches') = :P_BRANCH_TYPE OR :P_BRANCH_TYPE is NULL)
and t.description is not null
and t.language ='AR'
and h.je_batch_id = b.je_batch_id
and
(case
when (cc.segment3 NOT like '4%' and cc.segment3 NOT like '5%')
then (between to_date(:P_Start_date,'dd/mm/rrrr') and to_date(:P_END_date,'dd/mm/rrrr'))
when (cc.segment3 like '4%' or cc.segment3 like '5%')
then (between to_date(:P_Start_date2,'dd/mm/rrrr') and to_date(:P_END_date,'dd/mm/rrrr'))
end) h.default_effective_date
and (case
when (cc.segment3 like '4%' or cc.segment3 like '5%')
then (h.default_effective_date)
end) between to_date('01/07/2012','dd/mm/rrrr') and to_date('31/07/2012','dd/mm/rrrr')*/
group by cc.segment3 , t.description , cc.segment1,h.currency_code;
the part between tages need to modigied -
Difference between Data staging and Dimension Table ?
Difference between Data staging and Dimension Table ?
Data Staging:
Data extraction and transformation is done here.
Meaning that, if we have source data in flat file, we extract it and load into staging tables, we take care of nulls, we change datetime format etc.. and after such cleansing/transformation at then end, load it to Dim/Fact tables
Pros: Makes process simpler and easy and also we can keep track of data as we have data in staging
Cons: Staging tables need space hence need memory space
Dimension Table:
tables which describes/stores the attribute about specific objects
Below is star schema which has dimension storing information related to Product, Customer etc..
-Vaibhav Chaudhari -
I need to make a query that checks to see if the start_date is less than sysdate and the end_date is greater than sysdate
SELECT * FROM table WHERE OFFICE_START_DATE < SYSDATE AND OFFICE_END_DATE > SYSDATE
What is the easiest way of doing this?
Thanksuser9179751 wrote:
It wasn't working for me initially but I had to format the date to validate.
SELECT * FROM TABLE WHERE OFFICE_START_DATE < TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')
AND OFFICE_END_DATE > TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS');As skvaish said, it looks as if your columns are character (varchar2, most likely) and not dates. And if so, your solution is still buggy. You should be doing
select *
from mytable
where to_date(office_start_date) < sysdate
and to_date(office_end_date) > sysdate;If you insist on thinking that a chracter string that looks like a date is a date, what do you make of this:
First, create a table with a char column used as a date:
SQL> drop table mydemo;
Table dropped.
SQL> create table mydemo (
2 alfa_date varchar2(11),
3 rite_date date
4 );
Table created.Now insert some data
SQL> --
SQL> insert into mydemo values ('01-JAN-2010', to_date('01-JAN-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('01-FEB-2010', to_date('01-FEB-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('01-APR-2010', to_date('01-APR-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('02-JAN-2010', to_date('02-JAN-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('02-FEB-2010', to_date('02-FEB-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('02-APR-2010', to_date('02-APR-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('03-JAN-2010', to_date('03-JAN-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('03-FEB-2010', to_date('03-FEB-2010','DD-MON-YYYY'));
1 row created.
SQL> insert into mydemo values ('03-APR-2010', to_date('03-APR-2010','DD-MON-YYYY'));
1 row created.
SQL> commit;
Commit complete.Now, select, and order on the alfa-date;
SQL> select * from mydemo order by alfa_date;
ALFA_DATE RITE_DATE
01-APR-2010 01-APR-10
01-FEB-2010 01-FEB-10
01-JAN-2010 01-JAN-10
02-APR-2010 02-APR-10
02-FEB-2010 02-FEB-10
02-JAN-2010 02-JAN-10
03-APR-2010 03-APR-10
03-FEB-2010 03-FEB-10
03-JAN-2010 03-JAN-10
9 rows selected.Are they in date sequence?
No they are not.
Why not?
Now select, and order on the properly defined date column.
SQL> select * from mydemo order by rite_date;
ALFA_DATE RITE_DATE
01-JAN-2010 01-JAN-10
02-JAN-2010 02-JAN-10
03-JAN-2010 03-JAN-10
01-FEB-2010 01-FEB-10
02-FEB-2010 02-FEB-10
03-FEB-2010 03-FEB-10
01-APR-2010 01-APR-10
02-APR-2010 02-APR-10
03-APR-2010 03-APR-10
9 rows selected.
SQL> spo off
Maybe you are looking for
-
Lost External RAID 5 after upgrading to Windows 8.1
I have a Proavio EB4FR External RAID 5 connected through the eSATA port. It worked with my Windows 7 Pro and Windows 8 Pro no problem, tonight I've upgraded to Windows 8.1. I can no longer see the RAID 5 drive. It is detected as an "Other" device wit
-
Advance payment before delivery date
Hello experts, I have a requirement that after creating PO I need to make advance payment 2 days before receiving goods(delivery date) in case of local vendors, whereas in case of International vendors I need to make advance payment 8 days before del
-
IMac's name (network name)
I recently bought the 24" 2.8 iMac and love it! Everything is working well and it really is a joy to use. My only question, and I have looked for an answer to this probably basic question, is how do I change the name of my machine - especially as it
-
Error using VC BI Kit - Error -32010:
Hi We have Installed VC V6.00.0030 on EP6 SP10 and have installed the BI Kit. We have configured an RFC system to the BW system and an SAP_BI_SAPQuery. When accessing the backend we can see the Queries but get the following error. Error -32010: Canno
-
Deleting users with Delegated Admin
Hope anyone can help with this: When I delete a user with Delegated Admin (For Messaging 5.x) the user seems to be deleted in iDA, but it is not deleted in LDAP. Therefore, I cannot re-use it's attributes (like E-mail address) for another (new) user.