How to realize the data based on a single column grouping
Hello PL/SQL gurus and experts.I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version
I have table-
DROP TABLE T2;
create table T2(Manager,Employee) as select
'Nikki','Ram' from dual union all select
'Nina', 'Rita' from DUAL union all select
'Mike', 'Radha' from dual union all select
'Michael', 'Ratnam' from DUAL union all select
'Hendi', 'Ratna' from dual union all select
'Robert', 'Raman' from dual union all select
'Maria', 'Rolly' from dual union all select
'Kistrien', 'Rachna' from dual union all select
'Andrew', 'Ritvik' from dual union all select
'Emma', 'Ramesh' from dual union all select
'Andy', 'Ranpal' from dual union all select
'Brandy', 'Raunak' from dual union all select
'Nikki','Shyam' from dual union all select
'Nina', 'Sita' from DUAL union all select
'Mike', 'Sadhna' from dual union all select
'Michael', 'Satnam' from DUAL union all select
'Hendi', 'Satna' from dual union all select
'Robert', 'Samar' from dual union all select
'Maria', 'Sameer' from dual union all select
'Kistrien', 'Samrachna' from dual union all select
'Andrew', 'Satvik' from dual union all select
'Emma', 'Somesh' from dual union all select
'Andy', 'Sonpal' from dual union all select
'Brandy', 'Samar' from dual union all select
'Emma', 'Piyush' from dual union all select
'Andy', 'Pavan' from dual union all select
'Brandy', 'Paramjeet' from dual;
Results-Manager Employee
Nikki
Ram
Shyam
Nina Rita
Sita
Mike Radha
Sadhna
Michael Ratnam
Satnam
Hendi Ratna
Satna
Robert Raman
Samar
Maria Rolly
Sameer
Kistrien Rachna
Samrachna
Andrew Ritvik
Satvik
Emma Ramesh
Somesh
Piyush
Andy Ranpal
Sonpal
Pavan
Brandy Raunak
Samar
Paramjeet
I thank you all in advance for your valuable time and input
In SQL, something like that...
SQL> ed
Wrote file afiedt.buf
1 select case when row_number() over (partition by emp.manager order by employee) = 1 then
2 mgr.manager
3 else
4 null
5 end as manager
6 ,emp.employee
7 from (select distinct manager from t2) mgr
8 join t2 emp on (mgr.manager = emp.manager)
9* order by mgr.manager, emp.employee
SQL> /
MANAGER EMPLOYEE
-------- ---------
Andrew Ritvik
Satvik
Andy Pavan
Ranpal
Sonpal
Brandy Paramjeet
Raunak
Samar
Emma Piyush
Ramesh
Somesh
Hendi Ratna
Satna
Kistrien Rachna
Samrachna
Maria Rolly
Sameer
Michael Ratnam
Satnam
Mike Radha
Sadhna
Nikki Ram
Shyam
Nina Rita
Sita
Robert Raman
Samar
27 rows selected.
If you want managers of their own ranks with employees you will need to it fudge.
SQL> ed
Wrote file afiedt.buf
1 select case when row_number() over (partition by emp.manager order by employee nulls first) = 1 then
2 mgr.manager
3 else
4 null
5 end as manager
6 ,emp.employee
7 from (select distinct manager from t2) mgr
8 join
9 (select distinct manager, null as employee from t2
10 union all
11 select manager, employee from t2
12 ) emp on (mgr.manager = emp.manager)
13* order by mgr.manager, emp.employee nulls first
SQL> /
MANAGER EMPLOYEE
-------- ---------
Andrew
Ritvik
Satvik
Andy
Pavan
Ranpal
Sonpal
Brandy
Paramjeet
Raunak
Samar
Emma
Piyush
Ramesh
Somesh
Hendi
Ratna
Satna
Kistrien
Rachna
Samrachna
Maria
Rolly
Sameer
Michael
Ratnam
Satnam
Mike
Radha
Sadhna
Nikki
Ram
Shyam
Nina
Rita
Sita
Robert
Raman
Samar
39 rows selected.
Tags: Database
Similar Questions
-
How to get the values based on the most recent date
Oracle Version 8i
How to get the new_value based on the most recent date
SELECT max (MODIFIED_ON), the Group LOG_ITEM_CHARACTERISTICS by MODIFIED_ON new_value - does not
Please, someone help me
CREATE TABLE LOG_ITEM_CHARACTERISTICS ( CHAR_LOG_ID NUMBER(10) NOT NULL, PIRM_ID VARCHAR2(8) NOT NULL, CONSTANT_FLAG VARCHAR2(1), CHARACTERISTIC_NAME VARCHAR2(25) NOT NULL, TYPE_NAME VARCHAR2(10) NOT NULL, NEW_VALUE VARCHAR2(3000), UOM VARCHAR2(10), MODIFIED_BY VARCHAR2(30), MODIFIED_ON DATE ) SET DEFINE OFF; Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187376, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '1', 'AMPS', 'EMPXD88', TO_DATE('10/25/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187377, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMPXD88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187378, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '0', 'AMPS', 'EMDXB88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187384, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '2', 'AMPS', 'EMAXC29', TO_DATE('11/10/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (187385, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55.1', 'VOLTS', 'EMAXC29', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_ON) Values (2400742, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (574093, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (574094, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (3131486, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (3131487, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '16-12-04', 'DD/MM/YY', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (3131488, '0307490N', 'Y', 'POWER SUPPLY', 'PS2030/WVL', 'ESSENTIAL', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (3131489, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (4759086, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (4759087, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (4759088, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '14/11/07', 'DD/MM/YY', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6646012, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646013, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646014, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6646015, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646016, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646057, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646058, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6646059, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648577, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648578, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6648579, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6648580, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:00', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON) Values (6648581, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:10', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648634, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS')); Insert into LOG_ITEM_CHARACTERISTICS (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON) Values (6648635, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS')); COMMIT;
user4587979 wrote:
Hi FrankYes, but I had more than 2 tables with item_characteristics, type_characteristics
If there are other tables involved, then CREATE TABLE and INSERT statements for them (for the relevant columns only). You must not post a lot of examples of data; usually just a couple of lines per table is enough to show the problem.
Also post the results desired from these data.What I try to do is, I'm comparing new_value in log_item_characteristics (whichever is most recent) with CHR_VALUE in the item_characteristics and the needs of different output values
I am trying to query is not giving desired out put
Point out some places where the output is wrong and explain how you get good results in these places, using specific examples from the data sample.
select lic.PIRM_ID, ic.CHR_ID, lic.CHARACTERISTIC_NAME, lic.TYPE_NAME, ic.CHR_VALUE, lic.NEW_VALUE, lic.MODIFIED_BY, lic.MODIFIED_ON, ic.CREATED_BY, ic.CREATED_ON,ic.MODIFIED_BY, ic.MODIFIED_ON from log_item_characteristics lic, item_characteristics ic,type_characteristics tc where lic.TYPE_NAME=tc.TYPE_NAME and lic.CHARACTERISTIC_NAME=tc.CHR_NAME and lic.PIRM_ID=ic.PIRM_ID and tc.CHR_ID=ic.CHR_ID and ic.CHR_VALUE <> lic.NEW_VALUE and lic.pirm_id in ('0307490N','0307521C') order by lic.pirm_id
Thank you; It is useful to see the existing query. Really, you have to format your code.
Please can you help me
What you've posted so far is like saying "I'm going 200 meters to the North, and then 500 meters East, but I'm not getting where I want to go." I would have a better chance to help you if you said, 'I'm out of my house, at 100, Elm Street and try to get to the supermarket at Broadway 279. I'm going 200 meters to the North... ', or, even better. "I want to buy a newspaper and some orange juice, so I thought I'd go to a convenience store. I start at my house, at 100, Elm Street... »
Always post some examples of data (CREATE TABLE and INSERT statements, as you did in your first post) and the desired results from these data. Explain how you get these results from these data. -
How to get the 'DAY' based on the territory of current account held a number between
Hi all
Looks like I'm at the end of my intelligence here but how to get the 'DAY' based on the territory of current account with a number between 1 and 7? Oracle has functions to extract the day of the week, but I can't find the other way around.
I need a way to know that the number '3' on the database with NLS_TERRITORY = AMERICA means a 'Tuesday' or the number '2' on a database with NLS_TERRITORY = GERMANY means "Tuesday" as well.SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Release 11.2.0.3.0 - 64bit Production PL/SQL Release 11.2.0.3.0 - Production CORE 11.2.0.3.0 Production TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production SQL> alter session set nls_territory=AMERICA; Session altered. SQL> select to_char (sysdate, 'D') from dual; T - 3 SQL> alter session set nls_territory=GERMANY; Session altered. SQL> select to_char (sysdate, 'D') from dual; T - 2
Hope I am clear enough.
And wish you all a happy new year :)
Kind regards
SmailUse the format "IW" to get the date of Monday and the format "DAY" to get the "first day of the week. Then compare dates to see if they are identical.
ALTER SESSION SET NLS_TERRITORY = 'AMERICA'; SELECT TRUNC(SYSDATE-LEVEL, 'IW') "Monday", TRUNC(SYSDATE-LEVEL, 'DAY') "NLS First day of week", MOD(TRUNC(SYSDATE-LEVEL, 'IW') - TRUNC(SYSDATE-LEVEL, 'DAY') + 7, 7) "1 if day 1 = SUN, 0 if MON" FROM DUAL CONNECT BY LEVEL <= 7; Monday NLS First day of week 1 if day 1 = SUN, 0 if MON --------- --------------------- -------------------------- 31-DEC-12 30-DEC-12 1 24-DEC-12 30-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 24-DEC-12 23-DEC-12 1 alter session set nls_territory = 'FRANCE'; SELECT TRUNC(SYSDATE-LEVEL, 'IW') "Monday", TRUNC(SYSDATE-LEVEL, 'DAY') "NLS First day of week", MOD(TRUNC(SYSDATE-LEVEL, 'IW') - TRUNC(SYSDATE-LEVEL, 'DAY') + 7, 7) "1 if day 1 = SUN, 0 if MON" FROM DUAL CONNECT BY LEVEL <= 7; Monday NLS First day of week 1 if day 1 = SUN, 0 if MON -------- --------------------- -------------------------- 31/12/12 31/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0 24/12/12 24/12/12 0
Or it could be simpler:
ALTER SESSION SET NLS_TERRITORY = 'AMERICA'; WITH DATA AS (SELECT LEVEL INPUT_DAY FROM DUAL CONNECT BY LEVEL <= 7) SELECT INPUT_DAY, TO_CHAR(TRUNC(SYSDATE, 'Day')+INPUT_DAY-1, 'DAY') "Day label" from data; INPUT_DAY Day label --------- ------------------------------------ 1 SUNDAY 2 MONDAY 3 TUESDAY 4 WEDNESDAY 5 THURSDAY 6 FRIDAY 7 SATURDAY alter session set nls_territory = 'FRANCE'; WITH DATA AS (SELECT LEVEL INPUT_DAY FROM DUAL CONNECT BY LEVEL <= 7) SELECT INPUT_DAY, TO_CHAR(TRUNC(SYSDATE, 'Day')+INPUT_DAY-1, 'DAY') "Day label" from data; INPUT_DAY Day label --------- ------------------------------------ 1 MONDAY 2 TUESDAY 3 WEDNESDAY 4 THURSDAY 5 FRIDAY 6 SATURDAY 7 SUNDAY
-
How to display the data items in the header of tempalte
Hello friends
I have this date_from and date date_to parameters which are parameters that the user enters...
based on these parameters of date, I want to display in the header as
date_from day (for example if the date_from is 13 - nov - 2010.then I should see 13) and date_to to display as 15, if for example the user enters
November 16, 2010. (day of the date-1)
so it should break down for
date_from-13-nov-2010, 13
date_to-16-nov-2010, 15
I want these two values to display in the header of the template how
pls help
also let me know how to display the data items in the header template
Published by: Les on Dec 22, 2010 12:44 AMUse substring($date_from,1,2)?=""?> and number(substring($date_to,1,2))-1?=""?>
-
Anyone know how to check the date of warranty until when?
Anyone know how to check the date of warranty until when?
-
How to find the date item was my favorites on Mozilla Firefox
on system moot bookmark how to find the date of the bookmark?
In bookmarks menu select organize bookmarks to open the bookmarks library. In the bookmarks library, click views, and then display the columns and then added. This will display a column showing when a bookmark has been added.
-
How to set the date and time on my HP Officejet pro 8600 more?
How to set the date and time on my HP officejet pro 8600 more? It just on a printed journal Jan-oo-oo fax shows 00:00 AM. There are no instructions on how to change this. I need proof that I sent a fax to a certain date and time. Help, please. Thank you
Hello
Below are the steps to set the Date and time for your device:
- On the Control Panel, press the right arrow key ( ), press Setup ( ).
-
Camileo S20 - How to display the date and time
Hi, all. I got as Christmas present the Camileo S20, and I am not able to view the date and time in the video. In the manual is no reference on this subject, only how to set the date and time. But what is the intention to set the date and time in the camera, if it is not possible to display video?
Hello
Have you checked the user manual of your TV cam?
If it of possible to display the data and the time you can find in your user manual how to do this. It always interesting to read ;) s
-
How to reset the data counter without resetting the phone
How to reset the data counter each month so that I can control my data counter with our reset the phone (or) without using factory data reset.
Thanks for the reply much appreciated.
Parameters
Data Manager
Press the lower left key
Reset the data counter
-
How to save the data in table 1 d to Excel in continuous
Mr President.
How to save the data in table 1 d to Excel at all times, so that all the data of the first scan must be placed first thought and all the data from the second analysis must be placed on the second Board and continue on the street...
Sy@m...
Hi Sy@m
Here is a vi that might give you a few ideas to try:
-
How to read the date and time of a file by labview information
How to read the date and time of a file by labview information? for example, time created and updated time.
The similar question had already spoken here (this is the old thread but still seems topical):
http://forums.NI.com/T5/LabVIEW/file-date-created/TD-p/109836
-
How to analyze the data of the cDAQ and Signal Express, especially after analysis?
In the first series of tests of my instrument, it took longer than expected for the race. Thus, the data was saved in 6 days. The file is too large for export to Excel. At the beginning of the project, I was as ignorant as I could go ahead and add analysis and the scaling of measures. By the scaling, I mean my data of switching current dew points or whatever it is that I record.
How to evolve the data to read the output data as expected 4mA = point of dew of-20 C or 0 PSIG? Can I pre program this to be recognized for each event?
For real analysis I am doing – I would first analyze the data I recorded and choose different points to send to Excel to graph and analyze. Is this possible?
Secondly, I would like to know how to scale and analyze my data in the project without having to do this later analysis in the future?
I have a cDAQ-9172 with LabVIEW signal Express 3.0 that uses four modules - 9211 2 modules of thermocouple, my 4-20 1-9201 module +/-10V module and 1-9203.
Thank you for any assistance.
Hi Patricia,
"' You can do this by adding a step Load/Save signals ' analog '
. I hope this helps! -
Hello
I'm trying to follow the steps described in the following link:
How to set the Date and time on a remote target in Measurement & Automation Explorer (MAX)?
It is said
The software on the target currently supports only the time zoneand deletes the old files?
I need set the date and time
and remove all the old unwanted files
the calendar was gray does not allow me to change the current date.
Anyone know how to change
Hi all!
According to this the below Knowledge Base article, Remote Configuration System Support must be installed on the target for time settings to change in MAX.
If you don't know what version of the system supported remote Configuration software that you have installed on your device target, it is likely that it is not yet installed. Add this software by clicking below your target to the MAX software option and selecting "Add/Remove Software". This is where you will install the System Configuration Remote Support software.
Please let us know if you have any questions!
-
all my data records on the local disk c, how to share the data with the other drive, local drive d.
Hi Jasonbichard,
1. what type of drive is D? Is - this another partition on the same disk?
2 Windows operating system you are using?
You can change the location of the disk to save the data in the d: instead of C: and check if it helps.
a. navigate to the location (username) C:\Users\.
b. right click on the folder that you want to change the location, and then select Properties.
c. click on the location tab and change the location to D: drive.d. click on apply and Ok.
-
Multiple column trees: how to access the data in columns? There is a bug?
Hello
I have a strange problem. I use tree column multi like this:
In this case, I have the tree column and two other custom columns.
Now, how to access the data in the SECOND column?
We can write all the data in a row thanks the EditElementTree:AddElement:ChildText, because it is an array of strings.
However, when I want to read the data, I use ActiveCelltring, meaning that a SINGLE string and not a string table oO (so I only have the value of the first column and never others.
So, I can do what I want? Is this a bug?
Thank you very much
R0b1n
OK, I have the solution.
We play with the ActiveColumnNumber attribute, to read the values of different...
I left the message, it may be useful for later someboby
R0b1n
Maybe you are looking for
-
I can't properly test the latest version of RealDownloader; the module is disabled in FF 10. I have the latest version of RealDownloader, in which the incompatibility with FF10 is supposed to be fixed.
-
I get error error 0x800CCC6F 554 number I can't send emails
I am trying to send a large number of newsletters through outlook express. I got 80% of them, but got the last 5 and they will not go out. In fact, I can send is no longer emails. I get An unknown error has occurred. Account: "mail.comcast.net', serv
-
Hi, how to remove some albums of my Walkman App on my Z2? Thank you very much
-
The upgrade from Vista to Windows 7: How can I make sure that I keep Microsoft Office
A few months back I took advantage of this offer to upgrade from Vista to Windows 7 for a discounted price. After that I downloaded the upgrade file, Upgrade Advisor told me that because I'm using Vista business and I was upgrade 7, that my computer
-
This seems to have started randomly out of the blue and it's quite annoying. When you work with folders, I end up having a bunch of files that need to be closed and I usually don't want to close all; I usually have to sort numeorus files open to find