SQL Help for Date Range display
Gurus,
I have a sql statement like
select MIN(HIREDATE), MAX(HIREDATE) FROM EMP WHERE DEPTNO = 30My output looks like
MIN(HIREDATE) MAX(HIREDATE)
12/30/1998 12/30/2001Based on the values of MIN(HIREDATE) , MAX(HIREDATE) values
I need a SQL to generate the output like
12/30/1998
1/30/1999
2/28/1999
until Max(HIREDATE) value
In Feb we dont have 30th day, In that case take the last day of the month.
Thanks for great help
C 007
With 10g.
Regards Salim.WITH t AS
(SELECT min(hiredate) min_hiredate,
max(hiredate) max_hiredate
FROM emp_test
where deptno=30)
SELECT min_hiredate dt
FROM t
model
dimension by ( 1 rn)
measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
(min_hiredate[for rn from 1 to diff[1] increment 1]=add_months( min_hiredate[1],cv(rn)-1))
order by rn
SQL> WITH t AS
2 (SELECT min(hiredate) min_hiredate,
3 max(hiredate) max_hiredate
4 FROM emp_test
5 where deptno=30)
6 SELECT min_hiredate dt
7 FROM t
8 model
9 dimension by ( 1 rn)
10 measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
11 (min_hiredate[for rn from 1 to diff[1] increment 1]=add_months( min_hiredate[1],cv(rn)-1))
12 order by rn
13 /
DT
1998-12-30
1999-01-30
1999-02-28
1999-03-30
1999-04-30
1999-05-30
1999-06-30
1999-07-30
1999-08-30
1999-09-30
1999-10-30
1999-11-30
1999-12-30
2000-01-30
2000-02-29
2000-03-30
2000-04-30
2000-05-30
2000-06-30
2000-07-30
2000-08-30
2000-09-30
2000-10-30
2000-11-30
2000-12-30
2001-01-30
2001-02-28
2001-03-30
2001-04-30
2001-05-30
2001-06-30
2001-07-30
2001-08-30
2001-09-30
2001-10-30
2001-11-30
SQL>
Similar Messages
-
Using CVS in SQL Developer for Data Modeler changes.
Hi,
I am fairly new to SQL Developer Data Modeler and associated version control mechanisms.
I am prototyping the storage of database designs and version control for the same, using the Data Modeler within SQL Developer. I have SQL Developer version 3.1.07.42 and I have also installed the CVS extension.
I can connect to our CVS server through sspi protocol and external CVS executable and am able to check out modules.
Below is the scenario where I am facing some issue:
I open the design from the checked out module and make changes and save it. In the File navigator, I look for the files that have been modified or added newly.
This behaves rather inconsistently in the sense that even after clicking on refresh button, sometimes it does not get refreshed. Next I try to look for the changes in Pending Changes(CVS) window. According to the other posts, I am supposed to look at the View - Data Modeler - Pending Changes window for data modeler changes but that shows up empty always( I am not sure if it is only tied to Subversion). But I do see the modified files/ files to be added to CVS under Versioning - CVS - Pending Changes window. The issue is that when I click on the refresh button in the window, all the files just vanish and all the counts show 0. Strangely if I go to Tools - Preferences - Versioning - CVS and just click OK, the pending changes window gets populated again( the counts are inconsistent at times).
I believe this issue is fixed and should work correctly in 3.1.07.42 but it does not seem to be case.
Also, I m not sure if I can use this CVS functionality available in SQL Dev for data modeler or should I be using an external client such as Wincvs for check in/ check out.
Please help.
ThanksHi Joop,
I think you will find that in Data Modeler's Physical Model tree the same icons are used for temporary Tables and Materialized Views as in SQL Developer.
David -
Hi All,
I have requirement to write code for date range.
Characterstic = Run-Out Date, it was created reference to 0Date.
Requirement is data should load depends on Run-Out Date 7 days old and 14 days future.
Logic is -7 days old >= Run_out date <= 14 days future.
please let me know how I need to proceed with ABAP code for this requirement.
Thanks.
Please do not ask for ABAP code here. Its not a training forum
Edited by: Pravender on Aug 18, 2011 1:46 AM>
Sree vignesh wrote:
> Hi,
> In the select option we have a field month range as
> SELECT-OPTION : FROM 01.2007 TO 01.2009 " Let say Ur Selection option is SO_MONTH
> but now i need to add the DMBTR field considering the month range in the SELECT OPTION i.e., only FROM 01.2007 TO 01.2009 i mean without 2006 data.
>
> LOOP AT LT_DATA WHERE month in SO_MONTH. " Here add a Where condition
> ls_output-matnr = lt_data-belnr.
> ls_output-werks = lt_data-bukrs.
> ls_output-lgort = lt_data-dmbtr.
>
> COLLECT ls_output INTO lt_output .
>
> ENDLOOP.
>
> please help with code .
>
> thanks in advance.
Regards,
Suneel G -
Query to find first and last call made by selected number for date range
Hi,
query to find first and last call made by selected number for date range
according to filter:
mobile_no : 989.....
call_date_from : 25-april-2013
call_date_to : 26-april-2013
Please helpHi,
It sounds like you want a Top-N Query , something like this:
WITH got_nums AS
SELECT table_x.* -- or list columns wanted
, ROW_NUMBER () OVER (ORDER BY call_date ) AS a_num
, ROW_NUMBER () OVER (ORDER BY call_date DESC) AS d_num
FROM table_x
WHERE mobile_no = 989
AND call_date >= DATE '2013-04-25'
AND call_date < DATE '2013-04-26' + 1
SELECT * -- or list all columns except a_num and d_num
FROM got_nums
WHERE 1 IN (a_num, d_num)
;This forum is devoted to the SQL*Plus and iSQL*Plus front ends. This question doesn't have anything to do with any front end, does it? In the future, you'll get better response if you post questions like this in the PL/SQL.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the SQL forum FAQ {message:id=9360002} -
Search help for date field in Editable ALV
Hello Friends,
I am using editable alv using 'reuse_* '.
I have used date as input field. While creating fieldcatlog also i have declared dat as a mkpf-budat.
But i am not getting serach help for date in output.
Is it possible with reuse or i have to go by object oriented ?Hi,
Just pass the Edit option of the fieldcatalog for those specific fields...
fcat-edit = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND' "<---- pass this
i_callback_top_of_page = 'TOP'
is_layout = it_layout
it_fieldcat = it_fcat
i_default = 'X'
i_save = 'A'
it_events = it_event
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&DATA_SAVE'. "<-------check this
PERFORM save_data.
ENDCASE.
ENDFORM. "USER_COMMAND -
F4 help for date in select options..
Hi Gurus,
I want a search help for date field which belongs to select options.
I know if it is a parameter we directly map the attribute value to that data element.
Can some help me with this..
Best Regards,
Navin Fernandes.Hi Gurus,
The select options works for date.. I got the solution.
It directly relates to the default data dcitionary help.
Got it from this example: WDR_TEST_SELECT_OPTIONS
Best Regards,
Navin Fernandes. -
Hi,
I have created an iview in Visual Composer for a query. it contains date field on selection variable fomr. i tried entering date in various format, but it gives an error : variable expects interval value ; enter an interval".
can we provide search help for date field in VC?
Regards,
Sonali.Hi,
You have to create search help it avoid inconsistency.
Thanks & Regards,
Venkat. -
HI all,
I want to attach search help for a DATE field created in screen painter.
For PERNR, PREM is attached. Similarly what is the statndard search help name for DATE field?
Thanks,
Shanthi.Hi ,
Declare the date field as sy-datum ,
parameters : date type sy-datum .
This shud bring the standard search help for date .
Thanks ..Get back for any issues.
Anil -
To implement search help for date and time fields details
how can i implement search help for date and time fields in screen painter
Hi
Declare the variables as sy-datum and sy-uzeit or any other pre-defined data typ of date and ime types. Serach help will automatically comes.
Aditya -
Hi All,,
i want to add F1 help for data elements.How can i do this.Kindly suggest me the steps to perform this.hi
use this link
http://help.sap.com/saphelp_nw04/helpdata/en/a4/d47ee849e111d189730000e8322d00/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/45/11e39c459d7201e10000000a155369/frameset.htm
Cheers
Snehi
Edited by: snehi chouhan on Jul 24, 2008 11:10 AM -
Forum search doesn't seem to work for Date Range 'ALL'
Hi there,
Forum search doesn't seem to work for Date Range option: 'ALL' .
For a given search criteria, I get few search results when the date range is chosen as 'last year', but for the same search criteria, when the date range is chosen as ALL, no search results are shown (not even the ones shown earlier for last year selection).
regards,
AJCan you please delete my few duplicate replies in [CJ20n|Re: Long Text at Activity Level in CJ20N] thread?:-)
Cheers,
Amit. -
Which BW variable is used for date(range) when creating a portal service
Hi,
Can any one please let me know which BW variable is to be used for date(range) when creating a portal service for searching based on dates.
Thanks
AbhaiHi Arun,
its just a portal service which would be called when searching a document created on a particular date or betwwen a range of date.so what i require is which BW variable to be used when handling range.As for variable technical name we use VAR_NAME_I and for single value variable we VAR_VALUE_EXT_I
in the similar manner i want BW variable to be used for range of values.
Thanks
Abhai -
Dynamic Date Value for Date Range Parameter - Scheduling in BI
Hi,
I am New to BO Enterprise XI R3. I want to schedule the Crystal report which takes Date Range as parameter. Is any option available to calculate From Date automatically based on Current Date based on the range required?
Currently, Parameter option accepts parameters and enterprise process the report for configured parameters. In this case, report always prints only for configured date range eventhough report generated after one month. I am expecting report has to print data for date range (eg. 1 weeks, 4 days, or any range) based on system current date.
Thanks in Advance,
Venkateswaran.PI'm am in the same situation. I need to be able to have the date parameter dynamically change based on the current day's date when I schedule a report. However, because this parameter comes from a Stored Procedure from the database, it cannot be modified in the Report Designer (as far as I know). I've tried to set a default for it to use "currentdate" but it doesn't seem to take. Anyone know if this can be accomplished in the scheduler?
Thanks
-Tom -
Query for date range? JE
Hi,
I have seem some posts on the JE forum regarding quering for date range, but it is mostly using DPL.
Is there any way to do that using the JE API
Thanks,
MohammadHi Mohammad,
A date range query can be performed as a key range query. There's nothing special about dates except that you'll want to use a key binding that gives a meaningful sort order. If you're representing your dates in milliseconds, then a LongBinding (in com.sleepycat.bind.tuple) will work well. In general, use tuple bindings for keys, because they provide a meaningful sort order.
To perform a range query, this FAQ has some hints:
http://www.oracle.com/technology/products/berkeley-db/faq/je_faq.html#28
On range searches in general, they can be done with Cursor.getSearchKeyRange or with the SortedSet.subSet and SortedMap.subMap methods, depending on whether you are using the base API or the Collections API. It is up to you which to use.
If you use Cursor.getSearchKeyRange you'll need to call getNext to iterate through the results. You'll have to watch for the end range yourself by checking the key returned by getNext. This API does not have a way to enforce range end values automatically.
If you use the Collections API you can call subMap or subSet and get an Iterator on the resulting collection. That iterator will enforce both the beginning and the end of the range automatically.
Does this answer your question?
--mark -
Problems with F4 help for dates
Hi all.
In a redesign project we use a new structure for the bsp pages. Since the redesign every F4 help for dates is giving us a java script error.
Row: 689
Column: 3
Error: 'document.all.sapDate.style' is NULL or no object
Code: 0
URL: http://<server>:<port>/wbw(bD1..)/main.do
In the first version it was a view with some page fragments included containing the F4 helps.
The new application is a main view containing a changing view over command <bsp:call comp_id="...
Does the difference in place used matter?
I also removed the attribute themeRoot from <htmlb:content ...
Thanks for every hint,
Timo.I have exactly the same problem, someone can tell me how to fix it please ?
Here is my code for the "date" field :
CASE p_column_index.
WHEN 1.
DATA: tv_col1_inputfield TYPE REF TO cl_htmlb_inputfield.
CREATE OBJECT tv_col1_inputfield.
tv_col1_inputfield->id = p_cell_id.
tv_col1_inputfield->cellvalue = 'TRUE'.
tv_col1_inputfield->value = '20000131'.
tv_col1_inputfield->type = 'DATE'.
tv_col1_inputfield->showhelp = 'TRUE'.
tv_col1_inputfield->disabled = 'FALSE'.
p_replacement_bee = tv_col1_inputfield.
Edited by: BB.Fethi on Feb 8, 2010 2:10 PM
Ok sorry for this post, i haven't see the "remove tag htmlb:page"....
Edited by: BB.Fethi on Feb 8, 2010 2:13 PM
Maybe you are looking for
-
Wrong Vendor Invoice Posting Due To Wrong Excise Tax Code
Hi: We have created a Purchase Order as per below: Qty 10 Price 100 Value 1000 Excsie 10% 0 Cess 0 SECess 0 Value+Excise 1000 VAT 5% 50 ValueExciseVAT 1050 (Please note that the PO was to be created in the followin
-
I'm getting the kernal panic screen when I put in DVD
My iMac G5, 2 GB has been slow, and occasionally getting the "restart your computer" screen. I ran the Apple Hardware Test on it twice. It passed both times, so I decided it must be software. I proceeded to do a clean install of the OS. Now I'm getti
-
Tried to upgrade as instructed and after uninstalling and reinstalling (even back to the former iTunes which I was happy with)several times, keep getting message "Procedure entry point could not be located in dynamic link library" followed by "iTune
-
How to get more than 2 squares in Genius Mixes?
I have iTunes 9 and when I do Genius Mixes I get only 2 boxes when it says you get 12. How can I do this? Do I need to get more music?
-
So I have sms turned off in settings and imessaging turned on. I am usually prompted to send a text message if someone else cannot receive the imessage but with one of my contacts it occasionally automatically send an sms message without prompting m