Determine posting to an asset between two dates
Hello all,
How do you calculate the postings made to an asset between two dates? I looked at the logical database ADA, but got lost in the source code.
For example, if these posting were made to an asset between start & end date, the total I would want would be $300.
Post $200
post $100
post $200
reserse the 2nd $200.
Thanks
Bruce
Dear Friend,
Its very easy, simply execute transaction SQV and follow the below steps
Quick Viewer Screen appers
Create a new quick view
Give it a name, data source as table join, press enter.
Press Shift+F1, put the table name ANEK and press enter
Again press Shift+F1, put the table name as ANEP this time.
Press F3 or back button
Explode the Documnet Header and select List Filed and Selection Field check box for 1. Company Code 2. Main Asset Number, 3. Asset Sub Number,4. Fiscal Year, 5. Sequence Nuber, 6. Document Date or any other date on the basis of which you want to check the postings (e.g. posting date, entery date, asset valud date etc).
Press Execute button and enter.
A Report selection will appear, put the company code other parameters you have with you inclduing the date and execute again.
This will give you all posting between particular date.
Hope this solve your issue.
Thanks!!!
Murlidhar Khatri
Similar Messages
-
No of Fridays in between two date
Hi all
What is the Qucikest and easy way to retreive the NO of fridyas in betwen two dates
Thanks & Regards
Vivekvivekvm wrote:
Hi all
What is the Qucikest and easy way to retreive the NO of fridyas in betwen two dates
Make sure you test the boundary conditions for any solution you get.
Have you defined exactly what you mean by "in between two dates", for example. do you want to count the end points if one, or both, of them is a friday ?
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
"Science is more than a body of knowledge; it is a way of thinking"
Carl Sagan -
Periods between two dates .
Hi,
can anyone tell me any function module dat returns the no of periods between two dates .like
if i enter 02.02.2007
05.05.2007
then it shud return periods .
011
012
001
002
003
thnx ,
point will b assigned.Hi Nishu,
I think what you are looking for in the example below is periods 02, 03,04,05 when you enter dates 02.02.2007 to 05.05.2007.
you have to write a customer exit on posting period.
check the paper below on how to write customer exit and how to derive a variable from another variable.
https://websmp210.sap-ag.de/~sapdownload/011000358700002762582003E/HowToDeriveVariableValue.pdf
Jaya -
Hi
I have two date fields in the ODS..Both are characterists
1. Requested delivery date
2. Actual shipment end date.
I would like to create a calculated KF field for the difference between two dates in a query.
How can I accomplish it?
RegardsYou have to make Expiration data as nav attribute and create a formula variable then only this date can be used in calculations.
refer this How to...for the same
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/72f4a790-0201-0010-5b89-a42a32223ffc
later you can try to calculate difference between dates!
Re: calculating the difference between two dates
Please search in forum with 'difference between two dates'.You will find lots of good posts on this issue!
hope this helps
Regards -
How can I calculate the maximum number of days between two dates in a range of dates?
I have a column of dates spanning the couse of a few months. I would like to know if I can calculate the maximum number of days between each row and display the highest number. I currently have another column that calculates the days betwen the rows and I am currently just looking at the totals and highlighting the highest period.
Is this possible? Any help or suggestions are appreciated.
Thank you,
TrevorThis sounds totally possible, Can you post a screen shot of your table to make responding more focused? If you mean you want to:
A) compute the difference (in days) between two date in the same row, then
B) find the max duration (in days)
Here is my take on this problem:
D2 = C2-B2
select D2 and fill down
F1=MAX(D)
to perform the conditional formatting (to highlight the max duration) select column D, then set up conditional formatting as shown in the 1st image -
How to Calculate number of months between two dates
Hi All,
In one of the fomr developments, I have to calculate the
Number of Days
Number of Months ( Considering Leap Year) provided by the dates, end user enters in the form,
After going thorugh some forum discussion, I have come to know about so many things which were not clear till now.
I have gone through various forums too, some one suggets to make use of FORM CALC and some other JAVA SCRIPT. But the logic i want to build in java script.
The most interesting point is the DATE object is not getting created when i write the below code
var startDate = new DATE(oYear, oMonth, oDay);
I am still not clear, that really the date object gets created in Adobe form If so the why the alert box is getting populated when i write below lines
var oTemp = startDate.getFullYear();
xfa.host.messagebox(oTemp);
So, there are so many unclear things,
If any one can help me by suggesting the approach and how to build the logic in the JavaScript I would be really thankful
Regards
PavanChandHi,
ChakravarthyDBA wrote:
Hi
I want number of Sundays between two dates
example
number of Sundays count between '01-04-2013' and '30-04-2013' in one select query I have to include this as sub query in my select statement.Here's one way:
SELECT early_date
, late_date
, ( TRUNC (late_date + 1, 'IW')
- TRUNC (early_date, 'IW')
) / 7 AS sundays
FROM table_x
;This does not depend on your NLS settings.
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.
Point out where the statment above is getting the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
I can't really seem to get this straightened out.
SELECT distinct DATE, gross_total_return
FROM WPI_ICL
CASE Between '01-01-1980' AND '09-30-2008'
AND description = 'Broad Market Index United States Property (US Dollar)'
ELSE
description = 'S&P United States Property Residential (US Dollar)'
END
So, if records are between two dates, select a certain description, ELSE select a different description. I've tried IF...Then, and I've tried Case too. So far, nothing has worked out.
Can someone please give me a point in the right direction?
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.Here's a working example:
DECLARE @wpi_icl TABLE (date DATE, gross_total_return FLOAT, description1 VARCHAR(100), description2 VARCHAR(100))
INSERT INTO @wpi_icl (date, gross_total_return, description1, description2)
VALUES
('2008-09-29', 100.0, 'Broad Market Index United States Property (US Dollar)', 'S&P United States Property Residential (US Dollar)'),
('2008-10-01', 200.0, 'Broad Market Index United States Property (US Dollar)', 'S&P United States Property Residential (US Dollar)')
SELECT date, gross_total_return,
CASE WHEN date BETWEEN '1900-01-01' AND '2008-09-30' THEN description1
ELSE description2
END AS description
FROM @wpi_icl
From the code you posted, it seems you're unsure of the syntax of CASEs.
There are two ways to use a case. The first is the example above. You enclose the conditions between CASE and END.
Each condition has its own WHEN with a clause that evaluates to true or false. This clause can be made up of as many conditions as you like. After the clause comes a THEN. This is essentially what you want to happen if the clause returns true. WHEN/THEN is
synonymous with IF/THEN in this instance.
Including an ELSE is optional, but, be aware if you do not, and none of your WHEN clauses evaluate to true, you will have a NULL returned.
CASE
WHEN theseDriods = theDriodsWereLookingFor THEN callVader
WHEN theseDriods <> theDriodsWereLookingFor THEN moveAlong
ELSE goHomeAndRethinkLife
END
The other (less common) option operates like a SWITCH in some other languages. Its still surrounded by CASE and END but this time, the when just contains a value to be compared to the value at the start of the case:
CASE 16
WHEN 15 THEN 'too low'
WHEN 16 THEN 'just right'
WHEN 17 THEN 'too high'
END
Hope this helps. -
Difference between two dates: a complete solution
There have been many posts asking how to get the number of days between two dates. There is no method in java like the VB method dateDiff(), and there is only the method date.getTime() which gives you the number of milliseconds since Jan 1 1970, the Epoch. I have not seen a solution that makes use of the fact that there are 86400000 milliseconds per day, only when trying to get the number of days , i.e. multiples of 24 hours between two millisecond points in time.
So what if date1 was Oct 26th 11.30pm and date2 was Oct 27th 12.30am? If you get the millisecond difference, and divide by 86400000, you do not notice that these two times are on separate days, but only one hour apart.
My solution takes account of the modulo (%) function. If you use the date.getTime() method, and use % 86400000 on this number of milliseconds, it will tell you how far (milliseconds) this date is into this day, after 12am. If you subtract this amount from the total number of milliseconds, then divide by 86400000, this will give you the number of days after the Epoch, so you are able to know which day the millisecond time is in. If you want to know the days between two millisecond times, this will tell you, whereas just dividing by 86400000, will not, and may be misleading.
I think this could be incorporated into the Date class easily. There are some problems though, as not every day has 86400000 milliseconds, if you are talking about days when Daylight Saying Time begins or ends. Doing calculations like that will create errors, unless you know whether each date is in Daylight Saving Time or not. Leap years are OK, unless want to work out the number of years from the number of days by dividing by 365, as calculating numbers of days is only done by looking at a 24 hour time period. However where 'leap seconds' have been added, like once every ten years, there may be small errors. This was not included in anyone elses calculations.
So the calculation would go like this:
public class BetterDate extends Date
public int dayDifference(Date d)
long time = this.getTime() ; // gets milliseconds
long timed = d.getTime() ; // gets milliseconds of other date
int days = (time - (time % 86400000))/86400000 ; // number of days
int daysd = (timed - (timed % 86400000))/86400000 ; // number of days of other date
int difference = daysd - days ; // difference in days between two dates
return difference ;
If you want you can use the value (time % 86400000), and modulo this amount with the number of milliseconds in one hour, then subtract the result from the (time % 86400000) and divide by the millliseconds in one hour to give you the number of hours, but there are JDK functions that you can use to get the hour if needed.
This method is not perfect, but for most cases will get you the difference in days between two dates.
JamesHi James,
I tried out your solution, but it seems to fail on dates without times. I tries the difference between 31/03/2002 and 01/04/2002 and the result is 0. I guess it is because the times are assumed to be 00:00 as no times are mentioned and 31st March I believe is the date when DST change will take place this year. If I set the two times as well to a time much later than midnight for example 0600 then I seem to get the right answer.
Joag
There have been many posts asking how to get the
number of days between two dates. There is no method
in java like the VB method dateDiff(), and there is
only the method date.getTime() which gives you the
number of milliseconds since Jan 1 1970, the Epoch. I
have not seen a solution that makes use of the fact
that there are 86400000 milliseconds per day, only
when trying to get the number of days , i.e. multiples
of 24 hours between two millisecond points in time.
So what if date1 was Oct 26th 11.30pm and date2 was
Oct 27th 12.30am? If you get the millisecond
difference, and divide by 86400000, you do not notice
that these two times are on separate days, but only
one hour apart.
My solution takes account of the modulo (%) function.
If you use the date.getTime() method, and use %
86400000 on this number of milliseconds, it will tell
you how far (milliseconds) this date is into this day,
after 12am. If you subtract this amount from the total
number of milliseconds, then divide by 86400000, this
will give you the number of days after the Epoch, so
you are able to know which day the millisecond time is
in. If you want to know the days between two
millisecond times, this will tell you, whereas just
dividing by 86400000, will not, and may be
misleading.
I think this could be incorporated into the Date class
easily. There are some problems though, as not every
day has 86400000 milliseconds, if you are talking
about days when Daylight Saying Time begins or ends.
Doing calculations like that will create errors,
unless you know whether each date is in Daylight
Saving Time or not. Leap years are OK, unless want to
work out the number of years from the number of days
by dividing by 365, as calculating numbers of days is
only done by looking at a 24 hour time period. However
where 'leap seconds' have been added, like once every
ten years, there may be small errors. This was not
included in anyone elses calculations.
So the calculation would go like this:
public class BetterDate extends Date
public int dayDifference(Date d)
long time = this.getTime() ; // gets milliseconds
long timed = d.getTime() ; // gets milliseconds of
other date
int days = (time - (time % 86400000))/86400000 ; //
number of days
int daysd = (timed - (timed % 86400000))/86400000 ; //
number of days of other date
int difference = daysd - days ; // difference in days
between two dates
return difference ;
If you want you can use the value (time % 86400000),
and modulo this amount with the number of milliseconds
in one hour, then subtract the result from the (time %
86400000) and divide by the millliseconds in one hour
to give you the number of hours, but there are JDK
functions that you can use to get the hour if needed.
This method is not perfect, but for most cases will
get you the difference in days between two dates.
James -
How to count number of sundays between two dates
Hi
I want number of Sundays between two dates
example
number of Sundays count between '01-04-2013' and '30-04-2013' in one select query I have to include this as sub query in my select statement.Hi,
ChakravarthyDBA wrote:
Hi
I want number of Sundays between two dates
example
number of Sundays count between '01-04-2013' and '30-04-2013' in one select query I have to include this as sub query in my select statement.Here's one way:
SELECT early_date
, late_date
, ( TRUNC (late_date + 1, 'IW')
- TRUNC (early_date, 'IW')
) / 7 AS sundays
FROM table_x
;This does not depend on your NLS settings.
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.
Point out where the statment above is getting the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
Number of occurences between two dates based on a starting date + frequence
I have a starting date in cell A1 and a frequency (in days) in cell B1. In cell C1 I have a date (begin) and in cell C4 I have a later date (end). I need to know how often the event occurs during the time between begin and end dates (inclusive).
For instance, the starting date is january 25th, the frequency is 5. The first date is januari 25th, the second date is februari 12th. The result should be 2 (because given the starting date and frequency of the event, it will occur in februari on day 4 and 9).
I have been looking at some of the statistical functions, but I don't think there is a function for this. Right now I have about 5 formulas to calculate intermediate results, but I'm stuck trying to combine them.
I would be happy with just a pointer in the right direction. For instance, is there a specific name for this kind of calculation?michielvoo wrote:
I have a starting date in cell A1 and a frequency (in days) in cell B1. In cell C1 I have a date (begin) and in cell C4 I have a later date (end). I need to know how often the event occurs during the time between begin and end dates (inclusive).
For instance, the starting date is january 25th, the frequency is 5. The first date is januari 25th, the second date is februari 12th. The result should be 2 (because given the starting date and frequency of the event, it will occur in februari on day 4 and 9).
If the event occurs every five days, the second date will be January 30, and the event will occur four times " during the time between begin and end dates (inclusive)"
I have been looking at some of the statistical functions, but I don't think there is a function for this. Right now I have about 5 formulas to calculate intermediate results, but I'm stuck trying to combine them.
It's not really a statistical calculation, but a simple division to find "How many whole sets of five (days) are there in the days between two dates."
I would be happy with just a pointer in the right direction. For instance, is there a specific name for this kind of calculation?
Two functions and one operation are needed:
DATEDIF() to calculate the number of days between the start and end dates.
Division to determine how many sets of five days there are in that period.
INT() to discard the fractional part of the result.
With the values located as described, this formula (placed in a cell on the same table) will return the number of occurrences not including the first one.
=INT(DATEDIF(C1,C4,"D")/B1)
To include the Start date as one of the occurrences, make this modification:
=INT(DATEDIF(C1,C4,"D")/B1)+1
Regards,
Barry -
Query between two date columns ?
Oracle 11g R2
I'm trying too create a query between two date columns. I have a view that consists of many columns. There are two columns in question called valid_to and valid_from
Part Number Valid_from valid_to
100 01/01/2000 01/01/9999
200 01/01/2000 01/01/9999
300 01/01/2000 01/01/9999
etc
If I want to only see rows between with a date range of 01/01/2000 and 01/01/2013 how can I put this as SQL ?
Thanks in advanceHi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
See the forum FAQ: https://forums.oracle.com/message/9362002
If you want to find rows that have that exact range, then you can do something like
SELECT *
FROM table_x
WHERE valid_from = DATE '2000-01-01
AND valid_to = DATE '2013-01-01'
If you want to find rows where any or all or the range on the row overlaps any or all of the 200-2013 target range, then
SELECT *
FROM table_x
WHERE valid_from <= DATE '2013-01-02
AND valid_to >= DATE '2000-01-01'
If you want rows that are enritely within the target range, it's something else.
If you want rows that entirely enclose the target range, it's something else again. -
Difference between Two Date Should come into Text Item
Dear All,
i want to get difference between two date into text Item :P36_C in On Change java script.
i have two Date Item :P36_A and :P36_B .i have extract these date value from table then difference comes into Text Field :P36_C.
Now i want if i change Date into Item :P36_A or Item :P36_B then Defference between two date Should Come into Item :P36_C .
So i have use Java Script Code to do this
<script>
function diffdat(){
function getVal(item){
if($x(item).value != "")
return parseFloat($x(item).value);
else
return 0;
$x('P36_C').value =
getval((TO_DATE('P36_B', 'DD-MON-YYYY'))-
getval(TO_DATE('P36_A', 'DD-MON-YYYY')))+1;
</script>
i have put this into Item HTML Form Element Attributes
onChange="javascript:diffdat();"it's not woring .
How to work that Code with dates.
ThanksYou can always create your own difference function based on your own criteria. You can modify this to suit your needs.
CREATE OR REPLACE FUNCTION CALC_OFFICE_DAYS(date1 DATE, date2 DATE)
RETURN NUMBER
IS
v_begin_date DATE := date1;
v_end_date DATE := date2;
v_office_start_time VARCHAR2(10) := '09:30 AM';
v_office_end_time VARCHAR2(10) := '06:30 PM';
v_comp_begin_time DATE;
v_comp_end_time DATE;
v_days PLS_INTEGER := 0;
v_hrs NUMBER := 0;
v_ttltm NUMBER;
BEGIN
select trunc(v_end_date) - trunc(v_begin_date)
into v_days
from dual;
select to_date(to_char(sysdate,'DD-MM-YYYY')||' '||to_char(v_begin_date,'HH24:MI'),'DD-MM-YYYY HH24:MI')
into v_comp_begin_time
from dual;
select to_date(to_char(sysdate,'DD-MM-YYYY')||' '||to_char(v_end_date,'HH24:MI'),'DD-MM-YYYY HH24:MI')
into v_comp_end_time
from dual;
select (v_comp_end_time - v_comp_begin_time)/24 into v_hrs from dual;
IF v_hrs > 4 then
v_ttltm := v_days + .5;
ELSE
v_ttltm := v_days;
END IF;
return v_ttltm;
END;
As has been noted, this question is best posted on the PL/SQL forum. -
Findig dates between two dates
Hi everybody,
I have one table (TEST) with 2 columns having only one record
i need list of dates between from_date and to_date
the sample data...
from_date to_date
====== ======
02-JUL-09 17-JUL-2009
I found below query to retrieve the dates between two dates.
select to_date('02-jul-2009','dd-mon-yyyy')+level-1 dt from dual
connect by level<=to_date('17-jul-2009','dd-mon-yyyy')-to_date('02-jul-2009','dd-mon-yyyy')+1
It is working properly.
i have changed the above query with my table column names
select to_date(from_date,'dd-mon-yyyy')+level-1 dt from Test
connect by level<=to_date(to_date,'dd-mon-yyyy')-to_date(from_date,'dd-mon-yyyy')+1
In this case it is not working...
i am unable to find the reason...
Thank you.Hi,
It is working fine for me, what is the data type for from_date and to_date.
select to_date(from_date,'dd-mon-yyyy')+level-1 dt from Test
connect by level<=to_date(to_date,'dd-mon-yyyy')-to_date(from_date,'dd-mon-yyyy')+1;
DT
02-JUL-09
03-JUL-09
04-JUL-09
05-JUL-09
06-JUL-09
07-JUL-09
08-JUL-09
09-JUL-09
10-JUL-09
11-JUL-09
12-JUL-09
13-JUL-09
14-JUL-09
15-JUL-09
16-JUL-09
17-JUL-09Regards
Anurag Tibrewal
PS: Also post your output with the second query. -
Calculate the difference between two dates
I would like to calculate the difference between two dates in PL/SQL and return the result as a number of days expressed as an integer value.
Denes,
A fair point, I should really have posted this on the SQL forum (I'm new to the forum as well as PL/SQL) but thanks for responding anyway. It does raise a question as to how to implement this in ApEx though.
I have created the function and am calling it as shown below from the source window of a form. The source type is 'PL/SQL expression or function' and the expression in the source window of the form is:
calc_date_difference (:p26_c_payment, :p26_c_rec)
The two parameters being passed are of type date but I'm not sure how to handle the ruturned number and populate the form in ApEx with this value.
Is it possible to do it this way or am I taking completely the wrong approach?
Regards
Sandy
This is not ApEx related but SQL related:
CREATE OR REPLACE FUNCTION calc_date_difference (
p_date_1 VARCHAR2,
p_date_2 VARCHAR2
RETURN NUMBER
v_difference NUMBER;
v_sql_err VARCHAR2 (4000);
BEGIN
v_difference := TRUNC (TO_DATE (p_date_1)) - TRUNC
(TO_DATE (p_date_2));
RETURN v_difference;
CEPTION
WHEN OTHERS
THEN
v_sql_err := SQLERRM || CHR (10) || CHR (10) ||
SQLCODE;
ND calc_date_difference;and
SQL> SELECT calc_date_difference ('23.01.2007',
'20.01.2007') diff
2 FROM DUAL;
DIFF
3
Denes Kubicek -
[Urgent] Need help calculating difference between two dates
I'm trying to write a code to display the current day and time, then accept two dates from the user and display the difference between the two dates. To display the current date and time, I've used the SimpleDateFormatter library but I'm having difficulty calculating the difference between two dates. Could someone please help me with this?
Below is my code so far
import java.util.Date;
import java.util.Scanner;
import java.text.SimpleDateFormat;
public class DateFormatter {
public void displayNow()
Date todaysDate = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
String formattedDate = formatter.format(todaysDate);
System.out.println("Today's date and time is: "+formattedDate);
public void calculateDifference(Date startDate, Date endDate)
/* This is whre i need help! */
public static void main(String[] args)
DateFormatter df = new DateFormatter();
Scanner sc = new Scanner(System.in);
df.displayNow();
System.out.println("Please enter a date: ");
String date1 = sc.next();
System.out.println("Please enter another date: ");
String date2 = sc.next();
}The methods displayNow() and calculateDifference(Date startDate, Date endDate) are essential and cannot be skipped out.tarahmarie101 wrote:
Dude. I've tried doing assignments under pressure, and it doesn't work. Here's a piece of free advice. Start earlier next time, don't put "urgent" in the title of your post b/c it just pisses people off around here--and is a sure sign of an overdue homework assignment which no one around here likes helping with, and try to ask intelligent questions--don't just say "Help me!"
Of course, it takes some time to learn what the intelligent questions are. You have my sympathy. Try asking questions about how to do a particular task, instead of asking people to tell you what to do. It starts to get easier after a while.
actually dude i started on this on monday.. but there were so many other stuff to do along with this.. and i did try referring up the Calendar utility but it was a bit confusing actually.. it was only after that did i come to this forum.. nor am i very good at Java.. anyhoo thanks for your sympathies :P
Maybe you are looking for
-
Form settings in a form created from xml
Hello, I've load a form with a matrix from xml and I was wondering if its possible to group the lines and order the results via the form settings. The problem is that when I load the form, form settings button is deactivated. ¿Is there anyway to conf
-
DB and 10gAS infrastructure install...
Hello: We have an ERP product just like Oracle eBusiness suite (Oracle Applications) built using Oracle DB, Forms, Discoverer, Reports, Portal etc. for small and midsize companies (very low foot print compared to Oracle eBusiness suite). Our product
-
Plant and Material data in New GL
Currently, we are implementing ECC6 New GL and BW management reporting. The requirement is to report all inventory related costs and COGS by plant code. The profit center structure (model) is not supporting the plant view. Is there anyway to populate
-
Is it legitimate to call my Bible study software as MacBible?
I am a developer of a Bible study software. Can I call it MacBible and not be sued from Apple?
-
Sequence error: No more data to read from socket
We are getting the following error when inserting data into the center table. What does this error mean? We noticed if we take sequencing off the second table we do not get the error. ARe triggers for sequence are as follows. begin select db.insequen