query to get week number Pls help
I need to get the number of the week of the current year in the format 2008-W47 (this applies to sysdateWhen I try
Select to_CHAR (sysdate, 'YYYY' |'-IW')
OF THE DOUBLE
I get 2008-47
but in the format 2008-W47
Help
s
SQL> select to_CHAR(sysdate,'YYYY')||'-W'||to_char(sysdate,'IW') from dual
2 /
TO_CHAR(
--------
2008-W47
Tags: Database
Similar Questions
-
Query to get the number of records
Hi all
I would get the number of records in all tables in a schema. I don't want to run select count (*) of < table name >, because there are nearly 400 paintings. So I need a generic quqeyr that will give the recordcount for all tables.
Experts good help yourslef to tide me over.Do you need a specific account? Or an approximate count is sufficient? Do you use the RBO and CBO?
If you use the CBO and want an approximate count, column NUM_ROWS USER_TABLES should give you what you want.
If you need a specific account, you will have full scan all tables. You can automate this process via SQL dynamic, i.e.
DECLARE l_cnt INTEGER; BEGIN FOR x IN (SELECT table_name FROM user_tables) LOOP EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || x.table_name INTO l_cnt; dbms_output.put_line( 'Table ' || x.table_name || ' has ' || l_cnt || ' rows.' ); END LOOP; END;
Lawrence was also a [solution based on XML Query | http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html] to count all the rows in each table in a schema.
Justin
-
SQL query to get the number of days monthwise
Hello
I'm new to sql, can someone please tell me query to find the number of days between the two dates months wise.
say
FIRSTDATE last date
21/03/2011-25/06/2011
March April May June
9 22 23 18Hello
Welcome to the forum!
Here's one way:
WITH all_dates AS ( SELECT start_date + LEVEL - 1 AS a_date FROM ( SELECT TO_DATE ('21/03/2011', 'DD/MM/YYYY') AS start_date , TO_DATE ('25/06/2011', 'DD/MM/YYYY') AS end_date FROM dual ) CONNECT BY LEVEL <= end_date + 1 - start_date ) SELECT TO_CHAR ( TRUNC (a_date, 'MONTH') , 'fmMonth YYYY' ) AS month , COUNT (*) AS num_days FROM all_dates WHERE a_date - TRUNC (a_date, 'IW') < 5 GROUP BY TRUNC (a_date, 'MONTH') ORDER BY TRUNC (a_date, 'MONTH') ;
What is a 'working day '? I guess you mean every day except Saturday or Sunday, but the query aboveare sometimes figures less than you have asked:
MONTH NUM_DAYS --------------- ---------- March 2011 9 April 2011 21 May 2011 22 June 2011 18
Are a few days working on Saturday or Sunday? How do you get the 22 working days in April 2011 and 23 in may?
SQL is good at obtaining results with a variable number of rows, but you have to say exactly the desired number of columns when you write the query.
If you really need the output of the way you said, with any number of columns, then watch in swing or a grouping of the chain . See the FAQ forum
https://forums.Oracle.com/forums/Ann.jspa?annID=1535
"4. How can I convert rows to columns. -
How to remove network drives mapped Windows 7.i can't remove. Already disconnected, but still its disk showing with red cross.i am not able to create new drive with the drive letter of Red Cross, pls help me to solve it.
1. open a command prompt.
2 in the command prompt, type the following command and press ENTER.
NOTE: replaced by z: in the command below with the actual drive letter of the mapped network drive that you want to cancel your computer window (deletion) mapping .
- NET use Z:/delete
3 when finshed, close the command prompts. So the mapped network drive shoud be removed from the window of your computer.
Kind regardsJ Chambers -
How do I get the number of minutes each
Oracle DB 10
Hi all
I have using this query to get the number of records retrieved by the simultaneous min program,
SELECT count (distinct b.attribute2)
oe_order_headers_all a, oe_order_lines_all b
where a.header_id = b.header_id
and b.flow_status_code = 'AWAIT_QUINTIQ_BOOK. '
and to_Char (b.last_update_date, 'DD-MON-YYYY HH24:MI:SS'), between January 19, 2011 02:00:01 ' AND
JANUARY 19, 2011 02:00:02 '
This allows to get the number of records retrieved in a min.
How to find the count of the last 10 minutes, IE 1 mins County 2.00 to 2.10
Thanks and greetings
Srikkanth.MThis South for minute work wise County:
Select To_Char(b.last_update_date,'DD-MON-YYYY HH24:MI') DT, count (distinct b.attribute2)
oe_order_headers_all a, oe_order_lines_all b
where a.header_id = b.header_id
and b.flow_status_code = 'AWAIT_QUINTIQ_BOOK. '
and to_Char (b.last_update_date, 'DD-MON-YYYY HH24:MI:SS'), between January 19, 2011 02:00 ' AND
"JANUARY 19, 2011 02:10.
GROUP BY To_Char (b.last_update_date, 'DD-MON-YYYY HH24') -
get the number of days of the week to sysdate
Hi all
my need is to get the number of the day of the week of sysdate.
Here's how can I make it right now:
Select to_char(sysdate,'Dy') t1 double
But he returns the abbreviated name of the day of the week while I need number of days of the week.
Please help me. Thanks in advance.
Best regards
--
Marco
Or if you want the ISO week (Monday = day 1):
Select trunc (sysdate) - trunc(sysdate,'IW') + 1 double;
-
Oracle complicated query pls help
Select * from pq02create table PQ02(PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,1,null,'VIP1_DAT_MONT','''2008'''); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,2,'AND ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,3,'NOT ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,4,'( ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,5,'( ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,6,'( ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,7,null,'RF23_LIB_MARQ_DIS','''INFINITY'''); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,8,') ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,9,') ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,10,'AND ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,11,'( ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,12,'( ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,13,null,'RF73_COD_PIV_BOI','''CVT'''); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,14,') ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,15,'OR ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,16,'( ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,17,null,'RF73_COD_PIV_BOI','''DCT'''); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,18,') ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,19,') ',null,null); Insert into PQ02 (PQ02_NUM,PQ02_LIGN,PQ02_TYP_OPER_BLN,PQ02_CHMP,PQ02_VAL_CRIT) values (4072,20,') ',null,null);
I have to put the query and get the result as below
based on conditions that
(1) PQ02_TYP_OPER_BLN EXPECTED TO HAVE 3 OPEN BRACKETS (((IN ROW. IT IS HERE PQ02_LIGN 4,5,6
(2) the previous line (((ne doit PAS.)) HERE, IT IS PQ02_LIGN 3
PQ02_TYP_OPER_BLN 3) SHOULD HAVE 3 closed FLANGES))). This is where the 18,19,20
I want the records between these rows. It's like NOT (())
IN the MEANTIME, THESE ROWS I WANT THE VALUES only values rf73, Q02_VAL_CRIT "FPC", "DCT".
Pls help
sHello
Of course, you can do it.
If you don't want these spaces, then
(a) do not put them in the table in the first place, or
(b) use RTRIM to remove them before forming the txtIf you don't want pq02_typ_oper_bln to appear in txt, then don't mention pq02_typ_oper_bln in the formation of txt.
The parentheses are important, however. It seems that the output would be ambiguous without them.If you want PQ02_CHMP, followed of '=' followed by PQ02_VAL_CRIT where I used only PQ02_CHMP, then replace PQ02_CHMP with
PQ02_CHMP || ' = ' || PQ02_VAL_CRIT
during the formation of txt.
-
Due to the lack of days query... Pls Help gurus
I have a table that stores the presence information
For example:
Date of Emp_No
100 APRIL 1, 2010
102 APRIL 5, 2010
100 APRIL 2, 2010
I need a query with parameters from Date and to date...
My query result should be like this... given that 100 employee is absent for 8 days straight and employee number 102 is absent for 2 consecutive days...
It should return the number of consecutive days, he hasn't.
EmpNo consecutive days
100 8 days
102 days 2
Pls help gurus.
Published by: suzvino on June 21, 2010 12:14 AMTUBBY_TUBBZ?with data as 2 ( 3 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all 4 select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all 5 select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all 6 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all 7 select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all 8 select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all 9 select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all 10 select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all 11 select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all 12 select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all 13 select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual 14 ) 15 select 16 emp_no, max(level) 17 from data 18 connect by prior emp_no = emp_no and prior absent_date = absent_date - 1 19 group by emp_no 20 having max(level) >= 8; EMP_NO MAX(LEVEL) ------------------ ------------------ 100 9 1 row selected. Elapsed: 00:00:00.01 TUBBY_TUBBZ?
Think that I misread the post, the request should be
TUBBY_TUBBZ?with data as 2 ( 3 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all 4 select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all 5 select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all 6 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all 7 select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all 8 select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all 9 select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all 10 select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all 11 select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all 12 select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all 13 select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual 14 ) 15 select 16 emp_no, max(level) 17 from data 18 connect by prior emp_no = emp_no and prior absent_date = absent_date - 1 19 group by emp_no; EMP_NO MAX(LEVEL) ------------------ ------------------ 100 9 102 1 2 rows selected. Elapsed: 00:00:00.01
Published by: Tubby 30 May 2010 23:00
Second additional query because I misread the post originally.
-
How to get the name of the month of week number
Hi gurus,
I have week a year numbers.
I want to get the name of the month using the number of the week.
Is it possible to do this by using SQL.
Help, please.
Thank you
DominicSQL> var week number SQL> var year number SQL> SQL> begin 2 :year := 2007; 3 :week := 30; 4 end; 5 / PL/SQL procedure successfully completed. SQL> select to_char(trunc(to_date(:year,'yyyy'),'iyyy') + :week * 7, 'Month') month from dual 2 / MONTH --------- July SQL>
-
I get this message when I turn my macbook pro on "there is no set of application to open the document"stream_000b.strings ". "How can I get rid of him. pls help
Check preferences system/users and groups to see if this item is in your login items. If so, select it and use the sign less to remove.
If she is not there, see if you can find the file by using one of these programs. If you go Finder/display/show bar path, it will show you where it is located. You can then remove it.
-
I was installing 2 important updates, but I always get this error 646 (KB976321, KB981726) code, pls.help
You can search every download and manually install the same.
IE: http://www.microsoft.com/downloads/en/results.aspx?freetext=KB976321&displaylang=en&stype=s_basic
Save the update to a location on your hard drive, you can find and then install the update from there.
TaurArian [MVP] 2005-2010 - Update Services
-
Hi, I get this error msg everytime that restarts my system (with Windows Vista), pls help:
Windows cannot install the important updates:
(1) KB978542(2) KB971644
(3) KB974470(And Norton) McAfee applications are known to not uninstall (or upgraded) themselves.
1. download the McAfee Consumer Product Removal, save it to your desktop tool:http://download.mcafee.com/products/licensed/cust_support_patches/MCPR.exe
2. close all open applications (that is, anything with an icon on the taskbar).
3. right click on the file that you saved in #1 above and select run as administrator to run the utility. DO TAP not your keyboard until the race ends, then restart.
4. for good measure, reset IE now by http://support.microsoft.com/kb/923737
5. now to reset Windows Update by...
How to reset the Windows Update components?
[Access KB971058 via Internet Explorer (32-bit) only; Run the difficulty in the default and aggressive modes]
http://support.Microsoft.com/kb/9710586. restart once again & test.
~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft
-
try to install iTunes on my windows 7, but get windows installer services are not accessible... pls help
Transfer your question here: http://social.answers.microsoft.com/Forums/en-US/w7programs/threads ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft
-
whenever I select any folder or any icon in my computer win 7 I get a popup to remove this icon why this error comes how can I solve this problem pls help me
Hello
1. don't you make changes to the computer until the problem occurred?
2. What is the exact error message do you get?
I suggest you try the steps mentioned below and check if it helps.
Method 1: Start your system in safe mode and check if the same problem occurs.
http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode
Method 2 : If the issue does not exist in Mode safe mode then try to put your computer in a clean boot state.
By setting your boot system minimum state helps determine if third-party applications or startup items are causing the problem.
How to troubleshoot a problem by performing a clean boot in Windows Vista or Windows 7:
http://support.Microsoft.com/kb/929135Note: After the boot minimum troubleshooting step, follow step 7 in the link provided to return the computer to a Normal startup mode.
Follow these steps to reset the computer to start as usual:
(a) click on start toreduce this top that i, type msconfig.exe in the Start Search box and press ENTER.
If you are prompted for an administrator password or for confirmation, type your password, or click continue.
(b) under the general tab, click the Normal startup option, and then click OK.
(c) when you are prompted to restart the computer, click restart.
Method 3:
Also scan your computer from the Microsoft Security Scanner, which would help us to get rid of viruses, spyware and other malicious software.
The Microsoft Security Scanner is a downloadable security tool for free which allows analysis at the application and helps remove viruses, spyware and other malware. It works with your current antivirus software.
http://www.Microsoft.com/security/scanner/en-us/default.aspx
Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.
Hope this information is useful.
-
How can I get the number of week a week of prasent using simpleDateFormat class?
With regard to:
Jitendra.Balla
GetWeekOfYear DateTimeUtilities (calendar, long date, int firstDayofWeek)
Maybe you are looking for
-
I just upgraded to Sierra. The former 'user files' seems to have disappeared. As far as I can tell all the files are still there but they have just dumped in a big folder "All Files." I have deliberately never lit storage iCloud because I have my own
-
IPhone on the pricing policy disabled USB ports in Windows
Hello For safety, we stopped ports USB one our business using Group policies in a Windows environment. USB keys, USB, camera hard drives, phones, all are not allowed to install and use when connected to a computer. Capablities charge are still workin
-
When I print an email from Yahoo, the text wraps not (it was) then part of the text is cut off. In addition, the sidebar my Inbox, sent, drafts, etc. the list is printed with enamel - it has not used to and because of that there is not enough room fo
-
I need to get the card wirless working in 2 laptops.
After these 2 Dell laptops reformatting, I installed the Marvel network controller according to the Dell website. Although it has ethernet to work in both cases, I always get the error that miss me a network controller. Someone at - it understand it
-
I had the virus "XP Antivirus 2012" and now impossible to update MSE
I had the virus "XP Antivirus 2012" and now impossible to update MSE. Yesterday, I downloaded the Scanner of MS on another computer and transferred to the computer infected in safe mode and ran the Scanner from Ms. Fortunately, it removed the virus