How to Calculate second between two dates?
I'm wish to create a ref ID using seconds between two dates as the uniue number. I usually use DateDiff function in VB to calculate the ref ID. But now instead developing using VB, i'm using java in developing my project. I wonder is there any class similar to the datediff function? Please advice.Thank you
diff_sec =( Date1.getSeconds() - Date2.getSeconds());
Similar Messages
-
How to calculate days between two DATES
How to calculate days between two DATES ?
which is the functional module for that ?
help meHi,
use function module : it works,
HR_HK_DIFF_BT_2_DATES
give output format = 03 and get the value in days.
code is as below :
data : DATE1 type P0001-BEGDA,
DATE2 type P0001-BEGDA,
YEARS type P0347-SCRYY,
MONTHS type P0347-SCRMM,
DAYS type P0347-SCRDD.
date1 = '20070331'.
date2 = '20070101'.
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
DATE1 = date1
DATE2 = date2
OUTPUT_FORMAT = '03'
IMPORTING
YEARS = years
MONTHS = months
DAYS = days
EXCEPTIONS
INVALID_DATES_SPECIFIED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write : days.
Reward points, if helpful,
Regards,
Sandeep Kaushik -
Calculate difference between two dates/times
Hi all,
Is there any function module to calculate difference between two dates/times which are in TIMESTAMPL format.
I need to know how many millisconde(second,minutes, hours... )there is between these two times.
Please, It is urgent
Thank you all.
Karimhi,
try the following function
CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
EXPORTING
timestamp1 = timestamp1
timestamp2 = timestamp2
IMPORTING
difference = diff
EXCEPTIONS
OTHERS = 1.
the above function gives the difference in seconds...
try the following code to set the resolution to milliseconds..
SET RUN TIME CLOCK RESOLUTION LOW
check the thread for details:
SET RUN TIME CLOCK RESOLUTION?
all the best!!!
Regards,
Aparna -
How to caluclate tat between two dates of one timestamp field
Hi,
could some one help how to caluclate days between two dates of single timestamp filed and with this
query
Select * from m_activity_transaction where actn_opp_id in (
Select actn_opp_id from m_activity_transaction where ACTN_ACTV_ID = 218
Group by actn_opp_id
having count(*) > 1 ) and ACTN_ACTV_ID = 218
order by actn_performed_on
iam getting output is
ACTN_ID ACTN_OPP_ID ACTN_PERFORMED_ON
319415 95831 27-JAN-12 11.06.20.000000 AM
315249 95831 08-FEB-12 05.32.54.000000 PM
301927 103509 20-DEC-11 04.01.43.000000 PM
301458 103509 19-DEC-11 04.51.03.000000 PM
294841 115840 10-JAN-12 03.20.12.000000 PM
312062 115840 11-JAN-12 05.17.06.000000 PM
and i nedd to caluclate no.of days between two dates like 27-JAN-12 11.06.20.000000 AM and 08-FEB-12 05.32.54.000000 PM where actn_id is unique AND ACTN_OPP_ID IS NOT UNIQUE.
Thanks in Advance,
vvr.This way?
with data as
select 315249 a, 95831 b, to_timestamp('27-JAN-12 11.06.20.000000 AM', 'DD-MON-RR HH.MI.SS.FF6 AM') dt from dual union all
select 319415, 95831, to_timestamp('08-FEB-12 05.32.54.000000 PM', 'DD-MON-RR HH.MI.SS.FF6 AM') from dual union all
select 301927, 103509 , to_timestamp('20-DEC-11 04.51.03.000000 PM', 'DD-MON-RR HH.MI.SS.FF6 AM') from dual union all
select 301458 , 103509 , to_timestamp('19-DEC-11 04.01.43.000000 PM', 'DD-MON-RR HH.MI.SS.FF6 AM') from dual union all
select 363810 , 144656 , to_timestamp('27-JUN-12 12.43.28.000000 PM', 'DD-MON-RR HH.MI.SS.FF6 AM') from dual union all
select 363500 , 144656 , to_timestamp('26-JUN-12 11.41.50.000000 AM', 'DD-MON-RR HH.MI.SS.FF6 AM') from dual union all
select 363354 , 144656 , to_timestamp('25-JUN-12 12.41.13.000000 PM', 'DD-MON-RR HH.MI.SS.FF6 AM') from dual
select a, b, diff
from (
select a, b, extract( day from (dt - lag(dt) over (partition by b order by dt, a)) ) diff
from data
) tab
where tab.diff is not null;
A B DIFF
319415 95831 12
301927 103509 1
363500 144656 0
363810 144656 1 -
How to get days between two dates
Hi ,
How to get days between two dates.
Regards,
Ramesh.Hi Ramesh,
REPORT ZDATEDIFF.
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FROMDATE
i_date_to = TODATE
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS.
INITIALIZATION.
FROMDATE = SY-DATUM - 60. -
How to calculate hours between two dateTime node in BPEL.
In my BPEL there's a requirement need calculate hours between two dateTime type..
I tried 2 solutions, both of them failed:
1. use xslt calculate duration(xml type, like PT12H) between two dateTime, and then use embedded java code to get the hours.. The problem is : I need to parse the xml duration format...(like this real one: -P80DT17H47M36S....), and to parse it in java , maybe have the same problem with solution 2..
* [Subtracting 2 dateTime values into a duration using XPath 2.0|http://blogs.oracle.com/rammenon/2007/07/subtracting_2_datetime_values.html]
2. use embed java code, but it seems we can't use some class in embedded java code:
my code(input begin, end both dateTime in xml. output: diff, int in xml):
1 System.out.println("\n\nTimeTestBegin");
2 String begin=getVariableData("begin").toString();
3 String end=getVariableData("end").toString();
4 System.out.println(begin+"-----"+end);
5 //Class c1=Class.forName("javax.xml.datatype.XMLGregorianCalendar");
6 //Class c2=Class.forName("javax.xml.datatype.DatatypeFactory");
7 //System.out.println(c1.getName());
8 //System.out.println(c2.getName());
9 javax.xml.datatype.XMLGregorianCalendar beginTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(begin);
10 javax.xml.datatype.XMLGregorianCalendar endTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(end);
11 long diff=beginTime.toGregorianCalendar().getTimeInMillis()-endTime.toGregorianCalendar().getTimeInMillis();
12 setVariableData("diff",String.valueOf(diff/1000/3600));
13 System.out.println("DIFF======"+diff/1000/3600);
14 System.out.println("TimeTestEnd");
it's said can't compile java class, but can't find the detail error, I think the problem is how to import java class to embedded java code activity(use full package name like above code don't work), when I remove line 9-13, no compile error..
BTY: Jdeveloper is a IDE support java, but why the embedded java activity's edit window only have a simple "java code" editor, too simple that it can only edit you code snippet...
3.There's another sulotion: extend BPEL xpath functions(add a new function), but in my project, modify BPEL server(soa server)'s config file is not allowed..
Anyone know easy solution to my problem?
Thanks.Hi, All,
I found the cause. Sorry, it's my mistake..
below line have a DatatypeConfigurationException:
javax.xml.datatype.DatatypeFactory.newInstance()
When I test my java code snippet, I coped the code snippet to one of my java class in eclipse, and put it in a method to check if there's compile error, but I didn't notice there's a "throws Exception"...
the final java code snippet for test is :
input: begin dateTime
input: end dateTime
output: diff int, how many hours in (begin-end)
try{
System.out.println("\n\nTimeTestBegin");
String begin=getVariableData("begin").toString();
String end=getVariableData("end").toString();
System.out.println(begin+"-----"+end);
javax.xml.datatype.XMLGregorianCalendar beginTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(begin);
javax.xml.datatype.XMLGregorianCalendar endTime = javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(end);
long diff=beginTime.toGregorianCalendar().getTimeInMillis()-endTime.toGregorianCalendar().getTimeInMillis();
setVariableData("diff",String.valueOf(diff/1000/3600));
System.out.println("DIFF======"+diff/1000/3600);
System.out.println("TimeTestEnd");
}catch(Exception e){
e.printStackTrace();
} -
How to retrieve day between two dates?
Hi all,
Hope doing well,
sir i am retrieving day between two dates in sql server like this.
select datediff(day,'2012-10-03 00:00:00.000','2012-10-05 00:00:00.000')
and getting result that is: 2
but how this type of query i'll use in oracle?
thanks,Just do minus
diff := date_variable2-date_variable1;The difference sill be in days.
If you want just the differences in days (Neglecting time part)
diff := trunc(date2)-trunc(date1); -
How to calculate days between 2 dates excluding public holidays over SAP ?
Hi
Have a universe over SAP data. Trying to calculate days between 2 dates. SAP holds Public Holiday data in various tables e.g Thol and data is updated via scal. Using my univeres as a source I want to run reports for different countries so need to have various bank holidays not just UK. In SAP function modules handle this. Has anyone designed a solution to cater for this situation in a universe ?
Thanks in advance
MHi,
I assume you mean SAP R/3 (ECC) when you write SAP and SAP BW.
Are you using BW? If so, I would load the data into SAP BW, create a query using customer exit variables and build your universe on top of that...
-J -
How to make search between two dates accept null not obligatory search proplem
Hi guys when i search record between two dates it works ok success but you must enter date from and dateto first to to make search
i will show what i need from this example
I need to search dynamic by 4 textbox
1-datefrom
2-dateto
3-EmployeeNo
4-EmployeeName
but search i need must be dynamic meaning
if i enter employee no only give me employee no found in database
if i enter employee name give me employees found with this name using like
if i enter all 4 text box null and enter button search get all data
but i have proplem in this query when i need to search by click search button
i must write date from and date to firstly then write employee no or employee name if i need to search
so that i need to search by employee no alone or employee name alone without using date from and date to
And if i search without using datefrom and dateto it give me message error 'string wasnot recognized as valid datetime"
my stored procedure and code as following :
ALTER proc [dbo].[CollectsearchData]
@StartDate datetime,
@EndDate datetime,
@EmployeeID NVARCHAR(50),
@EmployeeName nvarchar(50)
as
Begin
Declare @SQLQuery as nvarchar(2000)
SET @SQLQuery ='SELECT * from ViewEmployeeTest Where (1=1)'
If (@StartDate is not NULL)
Set @SQLQuery = @SQLQuery + ' And (joindate >= '''+ Cast(@StartDate as varchar(100))+''')'
If (@EndDate is not NULL)
Set @SQLQuery = @SQLQuery + ' And (joindate <= '''+ Cast(@EndDate as varchar(100))+''')'
If @EmployeeID <>''
Set @SQLQuery = @SQLQuery + 'And (EmployeeID = '+ @EmployeeID+') '
If @EmployeeName Is Not Null
Set @SQLQuery = @SQLQuery + ' AND (DriverName LIKE
''%'+@EmployeeName+'%'') '
Print @sqlQuery
Exec (@SQLQuery)
End
Function using
public DataTable SearchDataA(string ConnectionString,string EmployeeNo,string EmployeeName, DateTime StartDate, DateTime EndDate)
SqlConnection con = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "CollectsearchData";//work
cmd.Parameters.Add("@StartDate", SqlDbType.DateTime);
cmd.Parameters.Add("@EndDate", SqlDbType.DateTime);
cmd.Parameters.Add("@EmployeeID", SqlDbType.NVarChar, 50);
cmd.Parameters.Add("@EmployeeName", SqlDbType.NVarChar, 50);
cmd.Parameters["@StartDate"].Value = StartDate;
cmd.Parameters["@EndDate"].Value = EndDate;
cmd.Parameters["@EmployeeID"].Value = EmployeeNo;
cmd.Parameters["@EmployeeName"].Value = EmployeeName;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
return dt;
interface button search
try
CultureInfo ukCulture = new CultureInfo("en-GB");
FleetManagment.Fleet fleet = new FleetManagment.Fleet();
DataTable Table = fleet.SearchDataA("Data Source=" + value1 + ";Initial Catalog=" + value2 + ";User ID=" + value3 + ";Password=" + value4 + "",textBox3.Text,textBox4.Text, DateTime.Parse(textBox1.Text,
ukCulture.DateTimeFormat), Convert.ToDateTime(textBox2.Text, ukCulture.DateTimeFormat));
dataGridView1.DataSource = Table;
dataGridView1.Refresh();
catch (Exception ex)
MessageBox.Show(ex + "error");Yes, the below code should not be passed any value: (I am not sure of the syntax in .NET,Sorry)
--If startdate len is 0 - do not assign this value
cmd.Parameters["@StartDate"].Value = StartDate;
--If endate len is 0 - do not assign this value
cmd.Parameters["@EndDate"].Value = EndDate; -
How to count days between two dates excluding saterady and sunday
Hi all
iam working on oracle sql/plsql.
In my application , i need to caliculate leave days between two dates excluding saterady and sunday
Please tell me the solution if any one knows
thanks in advance ,
baluMore modern version:
WITH date_tab AS
(SELECT TO_DATE ('&from_date', 'dd-MON-yyyy')
+ LEVEL
- 1 business_date
FROM DUAL
CONNECT BY LEVEL <=
TO_DATE ('&to_date', 'dd-MON-yyyy')
- TO_DATE ('&from_date', 'dd-MON-yyyy')
+ 1)
SELECT business_date
FROM date_tab
WHERE TO_CHAR (business_date, 'DY') NOT IN ('SAT', 'SUN');Thank you,
Tony Miller
Webster, TX
Never Surrender Dreams!
JMS
If this question is answered, please mark the thread as closed and assign points where earned.. -
How to calculate variance between two dimension values
Hello:
I have built a cube in Analytical workspace (9.2.0.5) with 3 dimensions. Time, Product & Scenario. I am using BI Beans (thick client) for the presentation layer. What I need is the ability to calculate the variance between two dimension values of same measure. For example, if My scenarios are 'Actual' and 'Budget', when I present the results on the screen for any measure (e.g Total Sales), I should be able to calculate & display the difference between 'Actual' & 'Budget' values of that measure.
I have more than 7 scenarios and more than 40 measures. It could even be the difference between two product categories. How do I do it either in AW or at BI Beans Level?
Thank you very much for your help.
regards
SureshYou want to look at qualified data references in the OLAP DML references. Basically, any data reference may be qualified by specifying a dimension name and value:
sales(time 'jan92')
forces the dimension TIME to the member 'jan92', no matter whether 'jan92' is in status or not. The resulting expression is essentially no longer dimensioned by the dimension TIME. -
Calcuate Hours: Minutes:Seconds between two dates excluding Weekends
Hello All,
@StartDate = '2014-06-21 13:37:30:037'
@EndDate = GetDate()
I want to find out Hours:Minutes:Seconds between the above dates EXCLUDING WEEKENDS.
Please help.
ReportingServicesHi,
Give this a try:
DECLARE @StartDate DATETIME = '2014-06-21 13:37:30:037'
DECLARE @EndDate DATETIME = GETDATE()
DECLARE @Base INT = 86400 -- ie Seconds in a days
;WITH cteCalculation AS (
SELECT ((
(DATEDIFF(dd, @StartDate, @EndDate) + 1)
-(DATEDIFF(wk, @StartDate, @EndDate) * 2)
-(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)
) * @Base)
-(CASE WHEN DATENAME(dw, @StartDate) NOT IN ('Saturday', 'Sunday') THEN DATEPART(hh, @StartDate) * 3600 + DATEPART(mi, @StartDate) * 60 + DATEPART(ss, @StartDate) ELSE 0 END)
-(CASE WHEN DATENAME(dw, @EndDate) NOT IN ('Saturday', 'Sunday') THEN @Base - (DATEPART(hh, @EndDate) * 3600 + DATEPART(mi, @EndDate) * 60 + DATEPART(ss, @EndDate)) ELSE 0 END)
AS DiffInSec
SELECT @StartDate
,@EndDate
,CAST(DiffInSec / 3600 AS VARCHAR(10)) + ':' +
RIGHT('0' + CAST((DiffInSec % 3600) / 60 AS VARCHAR(2)), 2) + ':' +
RIGHT('0' + CAST((DiffInSec % 3600 % 60) AS VARCHAR(2)), 2)
FROM cteCalculation
Feel free to modify to suit your needs!
Hope this helps.
~J. -
Problem with calculate difference between two dates on monday to saturday
Hello,
I need some help to edit a function tu return number of hours between to dates, including saturdays (09:00 - 14:00) and monday to friday (09:00-21:00);
This is my code;
CREATE OR REPLACE
FUNCTION TEST2( FECHA_INICIO DATE, FECHA_FIN DATE)
RETURN NUMBER IS HORASTOTALES NUMBER;
fecha date;
BEGIN
if(
SELECT fecha, to_char(fecha, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') Dia
FROM (SELECT to_date('FECHA_INICIO') + LEVEL - 1 fecha
FROM DUAL
CONNECT BY LEVEL <= (FECHA_FIN - FECHA_INICIO))
WHERE TO_CHAR(FECHA, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') not IN ('SAT') THEN
with t as (
SELECT CASE LEVEL
when 1 then greatest(fecha_inicio,trunc(fecha_inicio) + 9 / 24)
else trunc(fecha_inicio) + level - 15 / 24
end fecha_inicio,
case connect_by_isleaf
when 1 then least(fecha_fin,trunc(fecha_fin) + 21 / 24)
else trunc(fecha_inicio) + level - 3 / 24
end fecha_fin
from dual
connect by level <= trunc(fecha_fin) - trunc(fecha_inicio) + 1 )
select sum(greatest(fecha_fin - fecha_inicio,0)) * 24 horas
into horastotales
FROM T
WHERE TRUNC(FECHA_INICIO) - TRUNC(FECHA_INICIO,'iw') < 5 ;
RETURN HORASTOTALES ;
) ELSE IF
return HORASTOTALES+5;
END;
regardsOk, let's try this one then. it works as a function, and if you extract the query, it can work as a single cursor too.
create or replace function test2( p_start_date date, p_end_date date) return number
is
t_result number;
begin
with firstday as ( select case to_char(p_start_date,'fmdy','NLS_DATE_LANGUAGE=ENGLISH')
when 'sun' then 0
when 'sat' then 9-least(14,to_char(p_start_date,'hh24'))
else 9-least(21,to_char(p_start_date,'hh24'))
end day
from dual ),
alldays as (select sum(case to_number(to_char(p_start_date+level-1,'d'))
when 1 then 0
when 7 then 5
else 12
end) days
from dual
connect by level <= p_end_date - p_start_date + 1),
lastday as ( select case to_char(p_end_date,'fmdy','NLS_DATE_LANGUAGE=ENGLISH')
when 'sun' then 0
when 'sat' then -14+least(14,to_char(p_end_date,'hh24'))
else -21+least(21,to_char(p_end_date,'hh24'))
end day
from dual )
select sum(t1.day+t2.days+t3.day)
into t_result
from firstday t1
, alldays t2
, lastday t3;
return t_result;
end; -
How to calculate the month difference between two date char. in Query?
Customers would like to see how many months passed between two date type of characteristics (e.g., the month difference between the current date and the scheduled delivery date in the record) and put the result into the column as KF.
We would have to grab the fiscal year/period kind of value and then do the subtraction, e.g., if the current date value is 2/28/2008 and the scheduled delivery date value in the record is 12/01/2007, the correct result should be 2 month difference between these two date values, but could someone here give us the technical light on how to make this happen in query design?
Thanks and we will give you reward points for the correct anwsers!Hi Kevin,
The Badi is RSR_OLAP_BADI.
You can create an implementation using Transaction SE18.
The implementation is per cube and is defined in the filters.
In the Implementation you have the following methods :
1. Define : Here you will provide the Keyfigure you need as a virtual one.
2. Initilialize : Any Init Function you want to do.
3. Compute. This is called per datarecord and here you can cimpute your value.
Hope this helps.
Pralay Ahluwalia -
Hi,
i have create report using to table i have take search option in that report now i want to display report between two dates
How to put Between Date Quary in search option in where Clause .
My code is
select CRM_SALES_DEALs.id,
"CRM_SALES_CUSTOMERS"."CUSTOMER_NAME" as "CUSTOMER_NAME",
"CRM_SALES_SALESREPS"."REP_LAST_NAME"||', '||
"CRM_SALES_SALESREPS"."REP_FIRST_NAME" as "REP_NAME",
"CRM_SALES_DEALS"."DEAL_NAME" as "DEAL_NAME",
"CRM_SALES_DEALS"."EMAIL" as "EMAIL",
"CRM_SALES_DEALS"."DEAL_CLOSE_DATE" as "DEAL_CLOSE_DATE",
"CRM_SALES_DEALS"."DEAL_AMOUNT" as "DEAL_AMOUNT",
"CRM_SALES_DEALS"."DEAL_PROBABILITY" as "DEAL_PROBABILITY",
"CRM_SALES_DEAL_STATUS_CODES"."STATUS_CODE" as "STATUS_CODE" ,
"CRM_SALES_DEALS"."DATE_OF_QUARY" as "DATE_OF_QUARY",
"CRM_SALES_DEALS"."DEAL_SOURCE" as "DEAL_SOURCE",
"CRM_SALES_DEALS"."DEAL_AMOUNT" *
"CRM_SALES_DEALS"."DEAL_PROBABILITY" / 100 weighted_forecast,
(select count(*) from CRM_SALES_DEAL_products where deal_id = "CRM_SALES_DEALS".id) products,
nvl("CRM_SALES_DEALS".updated_on,"CRM_SALES_DEALS".created_on) last_changed,
t.territory_name,
CRM_SALES_DEALS.qtr, "CRM_SALES_DEALS"."CONTACT_NAME" as "CONTACT_NAME",
"CRM_SALES_DEALS"."ACTIVE_FLAG" as "ACTIVE_FLAG"
from
"CRM_SALES_SALESREPS",
"CRM_SALES_DEAL_STATUS_CODES" ,
"CRM_SALES_CUSTOMERS",
"CRM_SALES_DEALS",
CRM_SALES_territories t
where
CRM_SALES_customers.customer_territory_id = t.id(+) and
"CRM_SALES_DEALS"."CUSTOMER_ID"="CRM_SALES_CUSTOMERS"."ID"(+)
and "CRM_SALES_DEALS"."DEAL_STATUS_CODE_ID"="CRM_SALES_DEAL_STATUS_CODES"."ID"(+)
and "CRM_SALES_DEALS"."SALESREP_ID_01"="CRM_SALES_SALESREPS"."ID"(+) and "CRM_SALES_DEALS"."ACTIVE_FLAG" ='Y' and (:p1_find is null or instr(upper("CRM_SALES_CUSTOMERS"."CUSTOMER_NAME"),upper(:p1_find))>0 or instr(upper("CRM_SALES_DEALS"."DEAL_NAME"),upper(:p1_find))>0 or
instr(upper("CRM_SALES_SALESREPS"."REP_FIRST_NAME"||' '||"CRM_SALES_SALESREPS"."REP_LAST_NAME"),upper(:p1_find))>0)
and
(nvl(:P1_TERRITORY,0) = 0 or t.id= :P1_TERRITORY)
and
(nvl(:P1_ACCOUNT,0) = 0 or "CRM_SALES_CUSTOMERS".id = :P1_ACCOUNT)
and
(nvl(:P1_QUARTER,'0') = '0' or CRM_SALES_deals.qtr = :P1_QUARTER)
and
*("CRM_SALES_DEALS".created_on between :P1_CREATE_DATE and :P1_END_DATE ) >0 and* *Here I have put Quary*
instr(upper("CRM_SALES_DEALS"."CREATED_ON"),upper(nvl(:P1_CREATE_DATE,"CRM_SALES_DEALS"."CREATED_ON"))) > 0
and
nvl(DEAL_PROBABILITY,10) between nvl(:P1_MINIMUM_PROBABILITY,0) and nvl(:P1_MAXIMUM_PROBABILITY,100) AND
(nvl(:P1_LEAD_SOURCE,'0') = '0' or CRM_SALES_DEALS.DEAL_SOURCE = :P1_LEAD_SOURCE)Show me Error Command not Properly Ended
How can i search Between two date In Search option.
ThanksI'm guessing that this is Jay???
Please heed my numerous previous comments regarding formatting and those horrible full table aliases and upper case, double quoted names... Grrr...
Anyway, try this...
SELECT CRM_SALES_DEALs.id,
CRM_SALES_CUSTOMERS.CUSTOMER_NAME AS CUSTOMER_NAME,
CRM_SALES_SALESREPS.REP_LAST_NAME
|| ', '
|| CRM_SALES_SALESREPS.REP_FIRST_NAME
AS REP_NAME,
CRM_SALES_DEALS.DEAL_NAME AS DEAL_NAME,
CRM_SALES_DEALS.EMAIL AS EMAIL,
CRM_SALES_DEALS.DEAL_CLOSE_DATE AS DEAL_CLOSE_DATE,
CRM_SALES_DEALS.DEAL_AMOUNT AS DEAL_AMOUNT,
CRM_SALES_DEALS.DEAL_PROBABILITY AS DEAL_PROBABILITY,
CRM_SALES_DEAL_STATUS_CODES.STATUS_CODE AS STATUS_CODE,
CRM_SALES_DEALS.DATE_OF_QUARY AS DATE_OF_QUARY,
CRM_SALES_DEALS.DEAL_SOURCE AS DEAL_SOURCE,
CRM_SALES_DEALS.DEAL_AMOUNT * CRM_SALES_DEALS.DEAL_PROBABILITY / 100
weighted_forecast,
(SELECT COUNT ( * )
FROM CRM_SALES_DEAL_products
WHERE deal_id = CRM_SALES_DEALS.id)
products,
NVL (CRM_SALES_DEALS.updated_on, CRM_SALES_DEALS.created_on)
last_changed,
t.territory_name,
CRM_SALES_DEALS.qtr,
CRM_SALES_DEALS.CONTACT_NAME AS CONTACT_NAME,
CRM_SALES_DEALS.ACTIVE_FLAG AS ACTIVE_FLAG
FROM CRM_SALES_SALESREPS,
CRM_SALES_DEAL_STATUS_CODES,
CRM_SALES_CUSTOMERS,
CRM_SALES_DEALS,
CRM_SALES_territories t
WHERE CRM_SALES_customers.customer_territory_id = t.id(+)
AND CRM_SALES_DEALS.CUSTOMER_ID = CRM_SALES_CUSTOMERS.ID(+)
AND CRM_SALES_DEALS.DEAL_STATUS_CODE_ID =
CRM_SALES_DEAL_STATUS_CODES.ID(+)
AND CRM_SALES_DEALS.SALESREP_ID_01 = CRM_SALES_SALESREPS.ID(+)
AND CRM_SALES_DEALS.ACTIVE_FLAG = 'Y'
AND (:p1_find IS NULL
OR INSTR (UPPER (CRM_SALES_CUSTOMERS.CUSTOMER_NAME),
UPPER (:p1_find)) > 0
OR INSTR (UPPER (CRM_SALES_DEALS.DEAL_NAME), UPPER (:p1_find)) >
0
OR INSTR (
UPPER( CRM_SALES_SALESREPS.REP_FIRST_NAME
|| ' '
|| CRM_SALES_SALESREPS.REP_LAST_NAME),
UPPER (:p1_find)
) > 0)
AND (NVL (:P1_TERRITORY, 0) = 0 OR t.id = :P1_TERRITORY)
AND (NVL (:P1_ACCOUNT, 0) = 0
OR CRM_SALES_CUSTOMERS.id = :P1_ACCOUNT)
AND (NVL (:P1_QUARTER, '0') = '0'
OR CRM_SALES_deals.qtr = :P1_QUARTER)
AND CRM_SALES_DEALS.created_on BETWEEN :P1_CREATE_DATE
AND :P1_END_DATE
AND INSTR (
UPPER (CRM_SALES_DEALS.CREATED_ON),
UPPER (NVL (:P1_CREATE_DATE, CRM_SALES_DEALS.CREATED_ON))
) > 0
AND NVL (DEAL_PROBABILITY, 10) BETWEEN NVL (:P1_MINIMUM_PROBABILITY,
0)
AND NVL (
:P1_MAXIMUM_PROBABILITY,
100
AND (NVL (:P1_LEAD_SOURCE, '0') = '0'
OR CRM_SALES_DEALS.DEAL_SOURCE = :P1_LEAD_SOURCE)Cheers
Ben
Maybe you are looking for
-
Dear All, When I created physical inventory document by using MI31 some batches were not picked in the inventory documant.But other batches are been picked for the same material. I checked the batch characters in MSC3N it is same for both the batches
-
Hi, I get an error "Order Type 'OR' has not been defined in Sales area ,'BP01', 'AA', 'D1'>" [the sales area defined by me]. How to overcome this problem. Due to this I am unable to create a Sales Order. Please let me know. Thanks, Amba Prasanna
-
My Time Machine has failed again with this message: The backup disk image "/Volumes/Data/Shirley's MacBook Pro.sparsebundle" is already in use. How do I fix it?
-
Can i use track pad and mouse when using two displays
I have a second display I wonder if I can use my mouse for the other display and my track pad for my macbook pro. if not what will be the solution. ps: my second display is a tv.
-
Synchronization within the jserver (JVM)
Hi, Does anyone knows if 1.a java stored procedure 2.containing synchronized statements 3.called (with sql statement) by many different users will execute the synchronized blocks sequentially (user1 then user2 then user3) or at the same time (user1 a