Count consecutive appeareance
Hi,
I had a requirement like this
<pre>
In Table View output is like this
ID STATUS DATE
101 01 03-01-11
101 02 09-02-11
101 03 11-03-11
101 02 06-04-11
101 02 07-05-11
101 03 09-06-11
101 02 14-07-11
101 02 15-08-11
101 04 12-09-11
101 03 10-10-11
101 03 12-11-11
101 03 08-12-11
</pre>
<pre>
Required Output should be like this - for ID 101 and STATUS '01' is not required
STATUS 1Time 2Time 3&4Time 5&above
02 1 2
03 2 1
04 1
</pre>
Columns 1Time, 2Time,3&4Time, 5&above means count the number of consecutive appeareance of the status (have to check previous month status and next month status)
i.e for example if we take Status '02'
after checking previous month and next month status, Status '02' has appeared one time consecutively on '01-02-11'(Feb)
and hence 1 should come under '1Time' Column.
similarly after checking previous month and next month status, the number of 2 consecutive appereance of status '02' is twice, that is on ('01-04-11', '01-05-11') and ('01-07-11', '01-08-11'),hence the count of them will 2 under '2Time' column
For Status '03',
there are two one-time consecutive appeareance of the Status, that is on '01-03-11' and '01-06-11'. Hence count is 2 under '1Time' column for status 03
and Status '03' has single 3 consecutive appearance, that is on '01-10-11', '01-11-11', '01-12-11', hence count is 1 under 3&4Time coulmn.
Regards
mohan
I did answer your question in the other forum:
Count consecutive appearance
hm
Similar Messages
-
Count consecutive days in array
Hi,
I'm looking for an algorithm to count consecutive days in array, but i don't find one.
for example, if i have this array.
2009/07/01
2009/07/02
2009/07/03
2009/07/06
2009/07/08
2009/07/09
2009/07/10
2009/07/11
The result be
3
1
4
Anyone have one?
Thanks for all.jverd wrote:
kajbj wrote:
It's a fairly specialist algorithm so you are unlikely to find someone to post a solution. By just keeping a reference to the previous date, it is easy to iterate though the list counting consecutive dates.I think the trick to making this algorithm sucessful is to make sure that when you change months your algorithm doesn't set consec_days to 0 Why not?Presumably he's talking about this case:
7/31
8/1
and not this case
7/1
8/1
So he really should have said, "...when you increment month by one, or from 12 to 1, and the day went from the last day of the old month to 1, don't set consec_days to 0"Ok. I would use the Calendar class and SimpleDateFormat. The tricky part would otherwise be to keep track of days per month, and leap year. -
Counting consecutive numbers into one row
Hello everyone,
I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need. The pivoting function results to something like this:
01,02,03,05,06,07,08,09,10,11,12,13,14,16,17,20,21,23,25What I actually need is something like this:
1-17, 20-21,23,25I really don't know how to start solving this but so far I have the below query:
SELECT DISTINCT
MAX(DECODE(wldw.wafernumber,'01', '01'))
|| MAX(DECODE(wldw.wafernumber,'02', ',02'))
|| MAX(DECODE(wldw.wafernumber,'03', ',03'))
|| MAX(DECODE(wldw.wafernumber,'04', ',04'))
|| MAX(DECODE(wldw.wafernumber,'05', ',05'))
|| MAX(DECODE(wldw.wafernumber,'06', ',06'))
|| MAX(DECODE(wldw.wafernumber,'07', ',07'))
|| MAX(DECODE(wldw.wafernumber,'08', ',08'))
|| MAX(DECODE(wldw.wafernumber,'09', ',09'))
|| MAX(DECODE(wldw.wafernumber,'10', ',10'))
|| MAX(DECODE(wldw.wafernumber,'11', ',11'))
|| MAX(DECODE(wldw.wafernumber,'12', ',12'))
|| MAX(DECODE(wldw.wafernumber,'13', ',13'))
|| MAX(DECODE(wldw.wafernumber,'14', ',14'))
|| MAX(DECODE(wldw.wafernumber,'15', ',15'))
|| MAX(DECODE(wldw.wafernumber,'16', ',16'))
|| MAX(DECODE(wldw.wafernumber,'17', ',17'))
|| MAX(DECODE(wldw.wafernumber,'18', ',18'))
|| MAX(DECODE(wldw.wafernumber,'19', ',19'))
|| MAX(DECODE(wldw.wafernumber,'20', ',20'))
|| MAX(DECODE(wldw.wafernumber,'21', ',21'))
|| MAX(DECODE(wldw.wafernumber,'22', ',22'))
|| MAX(DECODE(wldw.wafernumber,'23', ',23'))
|| MAX(DECODE(wldw.wafernumber,'24', ',24'))
|| MAX(DECODE(wldw.wafernumber,'25', ',25')) AS WAFERS
FROM a_wiplothistory wl
JOIN Container C ON (wl.containerid = c.containerid OR wl.containerid= c.splitfromid )
JOIN a_wiplotdetailshistory wld ON wl.wiplothistoryid = wld.wiplothistoryid
JOIN a_wiplotdetailswafershistory wldw ON wld.wiplotdetailshistoryid = wldw.wiplotdetailshistoryid
WHERE c.containername = :lotThanks for helping guys.
Edited by: 1001275 on May 15, 2013 6:28 PMHi,
1001275 wrote:
Hello everyone,
I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need...You said it!
First, you need some way of grouping consecutive rows together (1-17 in one group, 20-21 in anoter, 23 as a group all by itself, and so on).
Then you need GROUP BY to get infmation about each goup, such as the smallest and largest number in the group.
Finally, you need to combine all that information into one big string. This is actually an example of String Aggregation , rather than pivoting. The two are closely related. Pivot means you're taking 1 column on multiple rows, and putting them into multiple columns on one row. String Aggregation is taking 1 column on multple row, and concatenating all their contents into one big string column.
Here's one way to do it:
WITH got_group_id AS
SELECT wafernumber
, ROW_NUMBER () OVER (ORDER BY wafernumber)
- wafernumber AS group_id
FROM wldw
, got_group_info AS
SELECT TO_CHAR (MIN (wafernumber))
|| CASE
WHEN COUNT (*) > 1
THEN '-' || TO_CHAR (MAX (wafernumber))
END AS group_label
, ROW_NUMBER () OVER (ORDER BY MIN (wafernumber))
AS group_num
FROM got_group_id
GROUP BY group_id
SELECT SUBSTR ( SYS_CONNECT_BY_PATH (group_label, ',')
, 2
) AS txt
FROM got_group_info
WHERE CONNECT_BY_ISLEAF = 1
START WITH group_num = 1
CONNECT BY group_num = PRIOR group_num + 1
AND prior sys_guid () is not null
;I find the first part of this query to be the trickiest. I used the Fixd Difference technique to assign a common group_id to consecutive rows. See {message:id=9953384} and/or {message:id=9957164} foran explantaion of the Fixed Difference technique.
Next, in sub-query got_group_info, I used aggregate functions to produce a group_label, such as '1-17', and to assign consecutive numbers to each group. This is also a little tricy, because it involves nesting an aggregate function (MIN in this case) inside an analytc function (ROW_NUMBER).
Finally, I used SYS_CONNECT_BY_PATH to do the string aggregation.
Output:
TXT
1-17,20-21,23,25Whenever you have a question, please post CREATE TABLE and INSERT statements for some sample data. For example:
CREATE TABLE wldw
( wafernumber NUMBER (3) PRIMARY KEY
INSERT INTO wldw (wafernumber) VALUES ( 1);
INSERT INTO wldw (wafernumber) VALUES ( 2);
INSERT INTO wldw (wafernumber) VALUES ( 3);
INSERT INTO wldw (wafernumber) VALUES ( 4);
INSERT INTO wldw (wafernumber) VALUES ( 5);
INSERT INTO wldw (wafernumber) VALUES ( 6);
INSERT INTO wldw (wafernumber) VALUES ( 7);
INSERT INTO wldw (wafernumber) VALUES ( 8);
INSERT INTO wldw (wafernumber) VALUES ( 9);
INSERT INTO wldw (wafernumber) VALUES (10);
INSERT INTO wldw (wafernumber) VALUES (11);
INSERT INTO wldw (wafernumber) VALUES (12);
INSERT INTO wldw (wafernumber) VALUES (13);
INSERT INTO wldw (wafernumber) VALUES (14);
INSERT INTO wldw (wafernumber) VALUES (15);
INSERT INTO wldw (wafernumber) VALUES (16);
INSERT INTO wldw (wafernumber) VALUES (17);
INSERT INTO wldw (wafernumber) VALUES (20);
INSERT INTO wldw (wafernumber) VALUES (21);
INSERT INTO wldw (wafernumber) VALUES (23);
INSERT INTO wldw (wafernumber) VALUES (25);I realize that your table (and your query) are a lot more complicated, but it looks like you can show the part you don't already understand using just this one table with this one column.
Also, whenever you have a question, say which version oif Oracle you'e using (e.g., 11.2.0.2.0).
The query above should work in Oracle 10.1 and up. I got the wong results in the main query in Oracle 10.2, however. (Oracle 10.2 has a lot of bugs related to CONNECT BY.) It worked fine in version 11.1.
If you're using Oracle 11.2, you'll want to use LISTAGG, not SYS_CONNECT_BY_PATH, to do the string aggregation.
For more about string aggregation in various versions of Oracle, see this Oracle Base page. -
Count consecutive Workdays where employee has taken SICK leave
I am trying to identify a way within sql to count the number of consecutive workdays (Monday - Friday) an employee has taken SICK leave. My problem in the past has been trying to count days whereas we cross the weekend. Currently I have 4 queries identifying patterns around the weekend that I run and export into an Excel Spreadsheet and manipulate from there. My goal is to be able to list an EMPLID (employee id), EMPL_RCD ( employee record), Min(DUR) (Date of absence), Max(DUR), and count of consecutive workdays.
Any help or guidance would will be appreciated. I have attached my current query.
I run my current query 4 times using the patterns below one at a time.
SELECT DISTINCT A.EMPLID,A.EMPL_RCD, A.DUR,b.dur,c.dur,d.dur, A.TL_QUANTITY, A.TRC
FROM PS_TL_RPTD_TIME A, PS_TL_RPTD_TIME B, PS_TL_RPTD_TIME C,PS_TL_RPTD_TIME D
WHERE A.EMPLID = B.EMPLID
AND A.EMPL_RCD = B.EMPL_RCD
AND A.EMPLID = C.EMPLID
AND A.EMPL_RCD = C.EMPL_RCD
AND A.EMPLID = D.EMPLID
AND A.EMPL_RCD = D.EMPL_RCD
AND B.EMPLID = C.EMPLID
AND B.EMPL_RCD = C.EMPL_RCD
AND B.TRC = C.TRC
AND A.TRC = B.TRC
AND A.TRC = C.TRC
AND A.TRC = D.TRC
AND (B.DUR = A.DUR+3 AND C.DUR = A.DUR+4 AND D.DUR = A.DUR+5) Friday, Monday, Tuesday, Wednesday
AND (B.DUR = A.DUR+1 AND C.DUR = A.DUR+4 AND D.DUR = A.DUR+5) Thursday, Friday, Monday, Tuesday
AND (B.DUR = A.DUR+1 AND C.DUR = A.DUR+2 AND D.DUR = A.DUR+5) Wednesday, Thursday, Friday, Monday
AND (B.DUR = A.DUR+1 AND C.DUR = A.DUR+2 AND D.DUR = A.DUR+3) -- Same workweek
AND A.TRC LIKE 'SICK%'
AND NOT EXISTS ( SELECT 'x' FROM PS_JOB J
WHERE J.EMPLID = A.EMPLID
AND J.EMPL_RCD = A.EMPL_RCD
AND J.EMPL_STATUS IN ('P','L')
AND J.EFFDT = ( SELECT MAX(J1.EFFDT) FROM PS_JOB J1
WHERE J1.EMPLID = J.EMPLID
AND J1.EMPL_RCD = J.EMPL_RCD
AND J1.EFFDT <= D.DUR))You should consider a technique from data warehousing where you use a table to describe dates. To keep things simple, let's create a table that holds all your valid business days for the past 2 weeks...
create table business_dates (business_day date);
begin
insert into business_dates values (to_date('16-oct-2006'));
insert into business_dates values (to_date('17-oct-2006'));
insert into business_dates values (to_date('18-oct-2006'));
insert into business_dates values (to_date('19-oct-2006'));
insert into business_dates values (to_date('20-oct-2006'));
insert into business_dates values (to_date('23-oct-2006'));
insert into business_dates values (to_date('24-oct-2006'));
insert into business_dates values (to_date('25-oct-2006'));
insert into business_dates values (to_date('26-oct-2006'));
insert into business_dates values (to_date('27-oct-2006'));
insert into business_dates values (to_date('30-oct-2006'));
insert into business_dates values (to_date('31-oct-2006'));
insert into business_dates values (to_date('01-nov-2006'));
insert into business_dates values (to_date('02-nov-2006'));
insert into business_dates values (to_date('03-nov-2006'));
end;
now we create a table that shows whether each employee was sick or not for a given work day...
create table attendance (empid number, business_day date, sick char(1));
insert into attendance values (100, to_date('16-oct-2006'), 'N');
insert into attendance values (100, to_date('17-oct-2006'), 'Y');
insert into attendance values (100, to_date('18-oct-2006'), 'Y');
insert into attendance values (100, to_date('19-oct-2006'), 'N');
insert into attendance values (100, to_date('20-oct-2006'), 'N');
insert into attendance values (100, to_date('23-oct-2006'), 'Y');
insert into attendance values (100, to_date('24-oct-2006'), 'Y');
insert into attendance values (100, to_date('25-oct-2006'), 'Y');
insert into attendance values (100, to_date('26-oct-2006'), 'N');
insert into attendance values (100, to_date('27-oct-2006'), 'N');
insert into attendance values (100, to_date('30-oct-2006'), 'N');
insert into attendance values (100, to_date('31-oct-2006'), 'Y');
insert into attendance values (100, to_date('01-nov-2006'), 'N');
insert into attendance values (100, to_date('02-nov-2006'), 'N');
insert into attendance values (100, to_date('03-nov-2006'), 'N');
insert into attendance values (105, to_date('16-oct-2006'), 'Y');
insert into attendance values (105, to_date('17-oct-2006'), 'Y');
insert into attendance values (105, to_date('18-oct-2006'), 'N');
insert into attendance values (105, to_date('19-oct-2006'), 'N');
insert into attendance values (105, to_date('20-oct-2006'), 'Y');
insert into attendance values (105, to_date('23-oct-2006'), 'N');
insert into attendance values (105, to_date('24-oct-2006'), 'N');
insert into attendance values (105, to_date('25-oct-2006'), 'Y');
insert into attendance values (105, to_date('26-oct-2006'), 'Y');
insert into attendance values (105, to_date('27-oct-2006'), 'Y');
insert into attendance values (105, to_date('30-oct-2006'), 'Y');
insert into attendance values (105, to_date('31-oct-2006'), 'Y');
insert into attendance values (105, to_date('01-nov-2006'), 'N');
insert into attendance values (105, to_date('02-nov-2006'), 'N');
insert into attendance values (105, to_date('03-nov-2006'), 'Y');
Now the query to get each sick occurrence and the number of consecutive days for each employee is...
select empid, first_sick_day, sick_count from
(select empid,
first_value(business_day) over (partition by empid, groupno order by business_day) as first_sick_day,
row_number() over (partition by empid, groupno order by business_day) as rn,
count(*) over (partition by empid, groupno) as sick_count
from
(select empid, business_day, daynum-rownum groupno
from
(SELECT a.empid, a.business_day, d.day_num as daynum
FROM attendance a,
(select rownum as day_num, business_day
from (select business_day from business_dates order by business_day)) d
WHERE sick = 'Y' AND a.business_day = d.business_day
ORDER BY 1,2 )
where rn = 1;
The above query can be modified slightly to only give you the sick occurrence with the maximum number of consecutive days for each employee.
Having a separate date table is nice because you can take in account weekends, holidays or any other nonwork day by just removing that date from the table. Generating this table is easy as date dimension examples can be found on on the web, and the amount of rows is small (250 rows per year approx).
JR -
Count consecutive month reset if gap in months
I have been hitting a road block on a report I have been trying to create. I am looking to find the most recent consecutive months for a specific ID. If there is a break in the months the counter would restart. I have been able
to create this but when there is a gap in the months my counter is not resetting.
Here is a sample table:
Declare @CTE Table (ID int, datestamp datetime);
insert @CTE(ID, datestamp)
select 8, '2013-11-15 00:00:00.000'
union ALL select 8, '2013-12-16 00:00:00.000'
union ALL select 8, '2014-01-15 00:00:00.000'
union ALL select 15, '2013-09-16 00:00:00.000'
union ALL select 17, '2014-02-28 00:00:00.000'
union ALL select 51, '2013-05-10 00:00:00.000'
union ALL select 51, '2014-04-10 00:00:00.000'
union ALL select 52, '2013-12-26 00:00:00.000'
union ALL select 59, '2013-08-12 00:00:00.000'
union ALL select 59, '2014-01-13 00:00:00.000'
union ALL select 59, '2014-04-14 00:00:00.000'
union ALL select 59, '2014-05-12 00:00:00.000'
union ALL select 62, '2013-06-10 00:00:00.000'
union ALL select 62, '2013-06-20 00:00:00.000'
union ALL select 62, '2013-10-10 00:00:00.000'
union ALL select 62, '2013-11-12 00:00:00.000'
union ALL select 64, '2013-05-28 00:00:00.000'
union ALL select 64, '2013-06-27 00:00:00.000'
union ALL select 64, '2013-07-29 00:00:00.000'
union ALL select 66, '2013-07-26 00:00:00.000'
union ALL select 74, '2013-04-15 00:00:00.000'
union ALL select 74, '2013-05-15 00:00:00.000'
union ALL select 82, '2013-09-03 00:00:00.000'
union ALL select 92, '2013-04-15 00:00:00.000'
Here is my query I am having issues with.
WITH test AS
SELECT ID, datestamp,
ROW_NUMBER() OVER(PARTITION BY ID ORDER BY datestamp) AS X
FROM @CTE
SELECT
ID,
COUNT(X) AS number_of_payments,
MIN(datestamp) as Min_date,
MAX(datestamp) as Max_date
FROM test
GROUP BY ID
order by ID
I am looking for results as follows.
ID Count
8 3
15 1
17 1
51 1
52 1
59 2
62 2
64 3
66 1
74 2
82 1
92 1Desired would be a count of records so when the flag turns 0 the count resets. So since row_id 321737 had the flag return as 0 the counter would start after that.
I want to be able to see ID 5539 is currently at 3
row_id ID flag enter_date flag_date
419390 5539
1 2014-05-02
00:00:00.000
2014-05-08
00:00:00.000
386558 5539
1 2014-04-18
00:00:00.000
2014-04-24
00:00:00.000
351279 5539
1 2014-04-04
00:00:00.000
2014-04-10
00:00:00.000
321737 5539
0 2014-03-21
00:00:00.000 NULL
298751 5539
1 2014-03-11
00:00:00.000
2014-03-17
00:00:00.000
236830 5539
1 2014-02-11
00:00:00.000
2014-02-18
00:00:00.000
187083 5539
1 2014-01-13
00:00:00.000
2014-01-17
00:00:00.000
142108 5539
0 2013-12-11
00:00:00.000 NULL
93199 5539
0 2013-11-12
00:00:00.000 NULL
62720 5539
0 2013-10-11
00:00:00.000 NULL -
hi,
I had this requirement, to count number of consecutive appearance of a status for a particular period dynamically
with x as (
select 101 as "ID", '01' as "STATUS", '01-01-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-02-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-03-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-04-11' as "DT" from dual
union
select 101 as "ID", '02'as "STATUS", '01-05-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-06-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-07-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-08-11' as "DT" from dual
union
select 101 as "ID", '04' as "STATUS", '01-09-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-10-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-11-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-12-11' as "DT" from dual)
select x.ID,x.STATUS,x.DT from x order by x.DT
<pre>
Output should be - ID 101 and STATUS '01' is not required
STATUS 1Time 2Time 3&4Time 5&above
02 1 2
03 2 1
04 1
</pre>
Columns 1Time, 2Time,3&4Time, 5&above means count the number of consecutive appearance of the status (have to check previous month status and next month status)
i.e for example if we take Status '02'
after checking previous month and next month status, Status '02' has appeared one time consecutively on '01-02-11'(Feb)
and hence 1 should come under '1Time' Column.
similarly after checking previous month and next month status, the number of 2 consecutive appearance of status '02' is twice, that is on ('01-04-11', '01-05-11') and ('01-07-11', '01-08-11'),hence the count of them will 2 under '2Time' column
For Status '03',
there are two one-time consecutive appearance of the Status, that is on '01-03-11' and '01-06-11'. Hence count is 2 under '1Time' column for status 03
and Status '03' has single 3 consecutive appearance, that is on '01-10-11', '01-11-11', '01-12-11', hence count is 1 under 3&4Time coulmn.
RegardsLike this?
-- Data:
with x as (
select 101 as "ID", '01' as "STATUS", '01-01-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-02-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-03-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-04-11' as "DT" from dual
union
select 101 as "ID", '02'as "STATUS", '01-05-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-06-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-07-11' as "DT" from dual
union
select 101 as "ID", '02' as "STATUS", '01-08-11' as "DT" from dual
union
select 101 as "ID", '04' as "STATUS", '01-09-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-10-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-11-11' as "DT" from dual
union
select 101 as "ID", '03' as "STATUS", '01-12-11' as "DT" from dual)
-- Query:
select status, sum(decode(c,1,1,0)) "1 Time",
sum(decode(c,2,1,0)) "2 Time",
sum(decode(c,3,1,4,1,0)) "3 or 4 Time",
sum(case when c>=5 then 1 else 0 end) "5 or above"
from
select status, d, count(*) c
from
select x.ID,
x.STATUS,
to_date(x.DT,'MM-DD-RR')-row_number() over (partition by status order by dt) d
from x order by x.DT
group by status, d
group by status
order by status;If you like you may add the condition
where status!='01'Edited by: hm on 11.01.2012 22:40 -
Count consecutive instances of a particular value
is there a way to have numbers look at a colum and give me the number of the highest consecutive anserws. Here is the example I am dealing with.
I would like to have a total at the bottom of each column that will calculate the most consecutive right answers in each column. That way I can award a prize to the person that got the most correct in a row.
StacyHi Stacey,
That's an interesting challenge. Here's my approach:
There are two Header Rows, even though I made the formatting change to make the second header row look like a body row for consistency with the rest of the data. The reason I did that is so that you can expand the table and have the new rows automatically fill with the formulas of the body rows. Adding rows when all body rows are the same causes the autofill behavior. I needed the first data row to have a different equation, so I used a header for the first row of data.
So, here are the equations:
B2: =IF(B="Right", 1, 0)
B3 to the last body row: =IF(B="Right", C2+1, 0)
Column B's first Footer row:
=COUNTIF(B, "Right")+COUNTIF(B2, "Right")
Column B's second Footer row:
=COUNTIF(B, "Wrong")+COUNTIF(B2, "Wrong")
Column B's third Footer row:
=MAX(C, C2)
That's it.
Regards,
Jerry -
Counting consecutive numbers in a view
Say I have the following data in a table:
ID YEAR
1 2004
1 2005
1 2006
1 2008
1 2009
2 1998
2 1999
2 2000
Is there anyway to return a 3rd row in a query which would return a 1 if the previous rows YEAR was 1 different, but a 0 if otherwise. So the data would look like this:
ID YEAR COUNT
1 2004 0
1 2005 1
1 2006 1
1 2008 0
1 2009 1
2 1998 0
2 1999 1
2 2000 1
2 2001 1
2 2002 1
2 2006 0
I am basically trying to find out if someones yearly membership was a renewal. Here's the data:
with t1 as (select 1 as ID,2004 as YEAR from dual union
select 1,2005 from dual union
select 1,2006 from dual union
select 1,2008 from dual union
select 1,2009 from dual union
select 2,1998 from dual union
select 2,1999 from dual union
select 2,2000 from dual union
select 2,2001 from dual union
select 2,2002 from dual union
select 2,2006 from dual)
select ID,
YEAR
from t1
order by id, year;
Thanks,
AndrewThanks for providing sample data and expected results!
I think this is what you want.
SQL> with t1 as (select 1 as ID,2004 as YEAR from dual un
2 select 1,2005 from dual union
3 select 1,2006 from dual union
4 select 1,2008 from dual union
5 select 1,2009 from dual union
6 select 2,1998 from dual union
7 select 2,1999 from dual union
8 select 2,2000 from dual union
9 select 2,2001 from dual union
10 select 2,2002 from dual union
11 select 2,2006 from dual)
12 SELECT ID
13 , YEAR
14 , (CASE
15 WHEN YEAR - LAG(YEAR) OVER (PARTITION BY ID ORDER BY YEAR) = 1
16 THEN 1
17 ELSE 0
18 END) AS RENEWAL
19 FROM t1
20 ORDER BY ID
21 , YEAR
22 /
ID YEAR RENEWAL
1 2004 0
1 2005 1
1 2006 1
1 2008 0
1 2009 1
2 1998 0
2 1999 1
2 2000 1
2 2001 1
2 2002 1
2 2006 0
11 rows selected. -
Hello, I try to count how often a true/false indicator is true. I'm using a "(U16) count: the number of TTL rising edges counted" after it, but with every incoming value the counter sets to 0. Therefore I always have 0 or 1 on the front panel instead of adding the new true to the previous ones. Thanks
Sounds like your counter might be in a While Loop using an initialized shift register, probably in a sub-vi. If you have a 0 connected to the left side register outside the loop, everytime the loop runs, it will reset the register to 0.
There are ways to initialize shift registers inside the loop if needed so this problem won't happen.
If this is not the problem, post some more details, or attach the code to another message so we can have a look.
Ed
Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences. -
Missing or invalid version of SQL library PSORA (200,0)
I am trying to configure App. Server on Vista laptop machine.
The machine name is VRGhati03.
It is a logical 3 tier archtecture. Its a EPM 9.0 Install. My database (PFDMO) is all configured and I am able to signon using a User ID VP1 and password VP1. My connect id is people with password of peop1e.
My access id is SYSADM.
I have created a user id in Oracle as VP1 and granted him the PSADMIN role .
When I try to boot up the App. Server it tells me ' Missing or invalid version of SQL Library PSORA' and 'Could not sign on to database PFDMO with user VP1'
The VP1 sign on works via SQLPLUS.
I also created a User Account of VP1 and tried to boot the appserver under that id but still no success.
I have gone thru some of the postings on this topic but they have not helped me. What am I doing wrong?
Below are the details of the log files, portion of my psappserv.cng file and the system environment variables.
Can somebody help. Thanks in advance
Sudhir
I) Log from APPSERV:
PSADMIN.10000 (0) [08/05/09 09:19:24](0) Begin boot attempt on domain PFDMO
PSWATCHSRV.2556 (0) [08/05/09 09:19:33] Checking process status every 120 seconds
PSWATCHSRV.2556 (0) [08/05/09 09:19:33] Server started
PSAPPSRV.5636 (0) [08/05/09 09:19:34](0) PeopleTools Release 8.49 (WinX86) starting
PSAPPSRV.5636 (0) [08/05/09 09:19:34](0) Cache Directory being used: C:\PT8.49\appserv\PFDMO\CACHE\PSAPPSRV_2\
PSAPPSRV.5636 (0) [08/05/09 09:19:34](1) GenMessageBox(200, 0, M): PS General SQL Routines: Missing or invalid version of SQL library PSORA (200,0)
PSAPPSRV.5636 (0) [08/05/09 09:19:34](1) GenMessageBox(0, 0, M): Database Signon: Could not sign on to database PFDMO with user VP1.
PSAPPSRV.5636 (0) [08/05/09 09:19:34](0) Server failed to start
PSWATCHSRV.2556 (0) [08/05/09 09:19:35] Shutting down
PSADMIN.10000 (0) [08/05/09 09:19:41](0) End boot attempt on domain PFDMO
II) Log from TUXLOG:
091924.VRGHATI03!PSADMIN.10000: Begin attempt on domain PFDMO
091927.VRGHATI03!tmadmin.9844.8684.-2: TMADMIN_CAT:1330: INFO: Command: boot -A
091929.VRGHATI03!tmboot.9720.8272.-2: 08-05-2009: Tuxedo Version 9.1, 32-bit
091929.VRGHATI03!tmboot.9720.8272.-2: CMDTUX_CAT:1851: INFO: TM_BOOTTIMEOUT is set to 60 seconds
091929.VRGHATI03!tmboot.9720.8272.-2: CMDTUX_CAT:1855: INFO: TM_BOOTPRESUMEDFAIL option is selected
091931.VRGHATI03!BBL.8340.3320.0: 08-05-2009: Tuxedo Version 9.1, 32-bit, Patch Level 036
091931.VRGHATI03!BBL.8340.3320.0: LIBTUX_CAT:262: INFO: Standard main starting
091933.VRGHATI03!tmboot.9224.8412.-2: 08-05-2009: Tuxedo Version 9.1, 32-bit
091933.VRGHATI03!tmboot.9224.8412.-2: CMDTUX_CAT:1851: INFO: TM_BOOTTIMEOUT is set to 60 seconds
091933.VRGHATI03!tmboot.9224.8412.-2: CMDTUX_CAT:1855: INFO: TM_BOOTPRESUMEDFAIL option is selected
091933.VRGHATI03!PSWATCHSRV.2556.9492.-2: 08-05-2009: Tuxedo Version 9.1, 32-bit
091933.VRGHATI03!PSWATCHSRV.2556.9492.-2: LIBTUX_CAT:262: INFO: Standard main starting
091934.VRGHATI03!PSAPPSRV.5636.9008.0: 08-05-2009: Tuxedo Version 9.1, 32-bit
091934.VRGHATI03!PSAPPSRV.5636.9008.0: LIBTUX_CAT:262: INFO: Standard main starting
091934.VRGHATI03!PSAPPSRV.5636.9008.0: LIBTUX_CAT:250: ERROR: tpsvrinit() failed
091934.VRGHATI03!tmboot.9224.8412.-2: tmboot: CMDTUX_CAT:827: ERROR: Fatal error encountered; initiating user error handler
091938.VRGHATI03!BBL.8340.3320.0: CMDTUX_CAT:26: INFO: The BBL is exiting system
091941.VRGHATI03!PSADMIN.10000: End boot attempt on domain PFDMO
III) System Environmental Variables:
LIBPATH=c:\oracle\product\10.2.0\db_1\LIB
ORACLE_SID=PFDMO
OS=Windows_NT
path=C:\oracle\product\10.2.0\db_1\bin;C:\product\10.1.3.1\OracleAS_1\jdk\bin;C:\product\10.1.3.1\OracleAS_1\ant\bin;C:\product\10.1.3.1\OracleAS_1\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\bea\Tuxedo9.1\bin
TUXDIR=C:\bea\Tuxedo9.1
IV) psappserv.cfg File:
[Startup]
;=========================================================================
; Database Signon settings
;=========================================================================
DBName=PFDMO
DBType=ORACLE
UserId=VP1
UserPswd=tRWpMM0Cragi9I0nrWPAxZ+GS1YD0PRXzCrF4YWbe5E=
ConnectId=people
ConnectPswd=kyD3QPxnrag=
ServerName=VRGhati03
[Database Options]
;=========================================================================
; Database-specific configuration options
;=========================================================================
SybasePacketSize=
UseLocalOracleDB=0
;ORACLE_SID=
EnableDBMonitoring=1
OracleDisableFirstRowsHint=0
[Security]
;=========================================================================
; Security settings
;=========================================================================
Validate Signon with Database=0
[Workstation Listener]
;=========================================================================
; Settings for Workstation Listener
;=========================================================================
Address=%PS_MACH%
Port=7000
Encryption=0
Min Handlers=1
Max Handlers=3
Max Clients per Handler=40
Client Cleanup Timeout=60
Init Timeout=5
Tuxedo Compression Threshold=5000
[JOLT Listener]
;=========================================================================
; Settings for JOLT Listener
;=========================================================================
Address=%PS_MACH%
Port=9000
Encryption=0
Min Handlers=5
Max Handlers=7
Max Clients per Handler=40
Client Cleanup Timeout=10
Init Timeout=5
Client Connection Mode=ANY
Jolt Compression Threshold=1000000
[JOLT Relay Adapter]
;=========================================================================
; Settings for JOLT Relay Adapter (JRAD)
;=========================================================================
Listener Address=%PS_MACH%
Listener Port=9100
[Domain Settings]
;=========================================================================
; General settings for this Application Server.
;=========================================================================
Domain ID=PFDMO
Add to PATH=c:\oracle\product\10.2.0\db_1\BIN
Spawn Threshold=1,600:1,1
Restartable=Y
;Log Directory=%PS_SERVDIR%\LOGS
; This allows for dynamic changes to certain setting without having to reboot
; the domain. The settings that can be dynamically changed are: Recycle Count,
; Consecutive Service failures, Trace SQL, Trace Mask SQL, TracePC, TracePCMask,
; TracePpr, TracePprMask, TracePIA, TracePIAMask, Log Fence, Enable DB Monitoring,
; Enable Debugging, LogErrorReport, MailErrorReport, DumpMemoryImageAtCrash
; These settings are further identified by the "Dynamic change allowed for .."
; comment.
Allow Dynamic Changes=N
; Logging detail level
; Level Type of information
; -100 - Suppress logging
; -1 - Protocol, memory errors
; 0 - Status information
; 1 - General errors
; 2 - Warnings
; 3 - Tracing Level 1 (default)
; 4 - Tracing Level 2
; 5 - Tracing Level 3
; Dynamic change allowed for LogFence
LogFence=3
; Trace-Log File Character Set: Character set used for log and trace files
Trace-Log File Character Set=ANSI
[PeopleCode Debugger]
;=========================================================================
; PeopleCode Debug Server settings
;=========================================================================
PSDBGSRV Listener Port=9500
; PeopleCode Debugger Trace Settings
; Level Type of tracing
; 0 Off (default)
; 1 Level 1 - log connection activity
; 2 Level 2 - log debug broker transactions (getsession, register/unregister, acquire/unacquire)
; 3 Level 3 - log primary debuggee/debugger transactions (register, modechange, seteventflag, break)
; 4 Level 4 - log debuggee/debugger variables transactions
; 5 Level 5 - log debuggee/debugger command responses and gotbreaks
; Warning: Levels 3 thru 5 result in lots of transaction data being logger and require plenty of disk space.
DebuggerMsgLogEnable=0
[Trace]
;=========================================================================
; Server Trace settings
;=========================================================================
; SQL Tracing Bitfield
; Bit Type of tracing
; 1 - SQL statements
; 2 - SQL statement variables
; 4 - SQL connect, disconnect, commit and rollback
; 8 - Row Fetch (indicates that it occurred, not data)
; 16 - All other API calls except ssb
; 32 - Set Select Buffers (identifies the attributes of columns
; to be selected).
; 64 - Database API specific calls
; 128 - COBOL statement timings
; 256 - Sybase Bind information
; 512 - Sybase Fetch information
; 1024 - SQL Informational Trace
; 4096 - Manager information
; 8192 - Mapcore information
; Dynamic change allowed for TraceSql and TraceSqlMask
TraceSql=0
TraceSqlMask=12319
; PeopleCode Tracing Bitfield
; Bit Type of tracing
; 1 - Trace Evaluator instructions (not recommended)
; 2 - List Evaluator program (not recommended)
; 4 - Show assignments to variables
; 8 - Show fetched values
; 16 - Show stack
; 64 - Trace start of programs
; 128 - Trace external function calls
; 256 - Trace internal function calls
; 512 - Show parameter values
; 1024 - Show function return value
; 2048 - Trace each statement in program (recommended)
; Dynamic change allowed for TracePC and TracePCMask
TracePC=0
TracePCMask=4095
; Panel Processor Tracing Bitfield
; Bit Type of tracing
; 1 - Log extra debug messages
; 2 - Dump panel after build
; 4 - Dump buffers after PPRInit
; 8 - Dump buffers before/after service
; 16 - Dump buffers after scrollselect
; 32 - Dump buffers after modal panel
; 64 - Dump buffers before save
; 128 - Dump buffers after insertrow
; 256 - Trace default processing
; 512 - Dump PRM data
; 1024 - Show function return value
; 2048 - dump memory statistics
; 4096 - Trace related display processing
; 8192 - Trace keylist generation
; 16384 - Trace work record settings
; Dynamic change allowed for TracePPR and TracePPRMask
TracePPR=0
TracePPRMask=32767
; PIA Page Generation Tracing Bitfield
; Bit Type of tracing
; 1 - Log page generation errors
; 2 - Show table layout via cell borders in generated page
; 4 - Annotate field overlap in HTML source
; 8 - Detailed trace of table generation algorithm
; 16 - Inline stylesheet in generated pages
; 32 - Inline javascript in generated pages
; 64 - QATesting - annotation and extra tags needed by Robot
; 128 - Format source. Make HTML more readable
; 256 - Save File. Save each generated page in log directory
; 512 - Debug JavaScript. Include debug functions in page
; 1024 - Log form data. Log all request parameters on each service
; 2048 - Log key errors. Write log message for unrecognized query parameters.
; Dynamic change allowed for TracePIA and TracePIAMask
TracePIA=0
TracePIAMask=32767
; AE Tracing Bitfield
; Bit Type of tracing
; 1 - Trace STEP execution sequence to AET file
; 2 - Trace Application SQL statements to AET file
; 4 - Trace Dedicated Temp Table Allocation to AET file
; 8 - not yet allocated
; 16 - not yet allocated
; 32 - not yet allocated
; 64 - not yet allocated
; 128 - Timings Report to AET file
; 256 - Method/BuiltIn detail instead of summary in AET Timings Report
; 512 - not yet allocated
; 1024 - Timings Report to tables, ignored if Process Instance is 0
; 2048 - DB optimizer trace to file
; 4096 - DB optimizer trace to tables
; 8192 - Transform trace
TraceAE=0
; Analytic Server Tracing Bitfield
; MostSignificantBit -> LeastSignificantBit
; QAS |ACE MODEL | ACE CALC | ACE API| Plugin | DCache | Utils | Analytic Server |
; 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
; Bit Type of tracing 3 bits per component (octal word)
; 1 - Analytic Server LSB
; 2 - Analytic Server MSB LSB LogFence
; 4 - Analytic Server MSB --- --- --------------------
; 8 - Utilities LSB 0 0 0 0 (Severity_Status)
; 16 - Utilities 0 0 1 1 (Severity_Error)
; 32 - Utilities MSB 0 1 0 2 (Severity_Warn)
; 64 - DataCache LSB 0 1 1 3 (Severity_Info)
; 128 - DataCache 1 0 0 4 (Severity_Trace1)
; 256 - DataCache MSB 1 0 1 5 (Severity_Trace2)
; 512 - Plug-in LSB 1 1 0 6 (not used)
; 1024 - Plug-in 1 1 1 7 (not used)
; 2048 - Plug-in MSB
; 4096 - ACE API LSB
; 8192 - ACE API
; 16384 - ACE API MSB
; 32768 - ACE CALC LSB
; 65536 - ACE CALC
; 131072 - ACE CALC MSB
; 262144 - ACE MODEL LSB
; 524288 - ACE MODEL
; 1048576 - ACE MODEL MSB
; 2097152 - QAS LSB
; 4194304 - QAS
; 8388608 - QAS MSB
; The bits enable logging for OptEngine components beyond the standard
; LogFence setting. E.g., TraceAnalytic=14380470 sets full trace on all components.
; Using 110 (1 greater than Severity_Trace2) for each component:
; OptEng: 4 + 2
; Utils : 32 + 16
; DC : 256 + 128
; Plugin: 2048 + 1024
; ACE API: 16384 + 8192
; ACE CALC: 131072 + 65536
; ACE MODEL: 1048576 + 524288
; QAS : 8388608 + 4194304
; Total : 14380470
TraceAnalytic=9586980
TraceAnalyticMask=16777215
; Performance Monitor Tracing Bitfield
; Bit Type of tracing
; 1 - Trace All performance monitor agent activity
TracePPM=0
; Create a memory image of the failing process during a crash
; Setting Meaning
; NONE no memory image
; MINI mini memory image
; FULL full memory image
; If set to MINI or FULL, when a crash occurs, a memory.dmp file is
; generated under <log directory>/<server name>.<process id>.
; Dynamic change allowed.
DumpMemoryImageAtCrash=NONE
;If set to Y, when a crash occurs, the application server process will write
;additional information to help in debugging the crash that occurred.
;This consists of the customized object definitions for reproducing
;the request on another database.
DumpManagerObjectsAtCrash=Y
; If set to Y, when a runtime error is detected, the message and a dump of
; the application state will be written to the current log file.
; Dynamic change allowed.
LogErrorReport=N
; When set to an email address, an email will be sent when an error report
; or a crash dump is written to the log.
; Dynamic change allowed.
MailErrorReport=
[Cache Settings]
;==============================================================================================
; Settings for managed object caching;
; Default EnableServerCaching=2, ServerCacheMode=0
; Default CacheBaseDir=%PS_SERVDIR% if defined else %PS_HOME/<domain name>/cache
; You can change these values by uncommenting and setting to the desired value
;==============================================================================================
; EnableServerCaching -
; 0 Server file caching disabled
; 1 Server file caching limited to most used classes
; 2 Server file caching for all types
;EnableServerCaching=2
; CacheBaseDir = the base file cache directory
;CacheBaseDir=%PS_SERVDIR%
; ServerCacheMode
; 0 One file cache directory per app server process
; 1 One file cache directory per domain (shared file cache, needs to be preloaded)
;ServerCacheMode=0
; Deprecated cache settings : MaxInMemoryObjects
; MaxCacheMemory - controls cache memory pruning
; 0 cache memory pruning disabled
; >0 max size of memory cache in MBytes
MaxCacheMemory=0
; Preload Cache projects for file and in memory cache
;PreloadFileCache=
;PreloadMemoryCache=
[RemoteCall]
;=========================================================================
; Settings for RemoteCall
;=========================================================================
; RemoteCall child process output redirection
; If this parameter is non-zero, the child process output is saved to
; <Domain Settings\Log Directory>\<program>_<oprid>.out, and any error
; output is saved to <program>_<oprid>.err.
; By default, the output is not saved
RCCBL Redirect=0
; Location of COBOL programs
; NT/Windows 2000: By default, RemoteCall looks for the COBOL programs in
; %PS_HOME%\cblbin%PS_COBOLTYPE%. PS_COBOLTYPE is automatically set when
; the application server is started. The value depends upon the database.
; Possible values:
; PS_COBOLTYPE = A (non-Unicode)
; PS_COBOLTYPE = E (EBCDIC)
; PS_COBOLTYPE = U (Unicode)
; UNIX: By default, RemoteCall looks for the COBOL programs in $PS_HOME/cblbin.
; You can override the default setting by commenting out the appropriate
; line and modifying the setting to fit your requirements.
; NT/Windows 2000:
;RCCBL PRDBIN=%PS_HOME%\cblbin%PS_COBOLTYPE%
; UNIX:
;RCCBL PRDBIN=%PS_HOME%/cblbin
[PSAPPSRV]
;=========================================================================
; Settings for PSAPPSRV
;=========================================================================
; UBBGEN settings
Min Instances=3
Max Instances=3
Service Timeout=300
; Number of services after which PSAPPSRV will automatically restart.
; If the recycle count is set to zero, PSAPPSRV will never be recycled.
; The default value is 5000.
; Dynamic change allowed for Recycle Count
Recycle Count=5000
; Percentage of Memory Growth after which PSAPPSRV will automatically restart.
; Default is 20, meaning additional 20% of memory growth after the process has
; built up its memory cache.
; Uncomment the setting to use memory growth instead of Recycle Count at
; determining the restart point.
; Percentage of Memory Growth=20
; Number of consecutive service failures after which PSAPPSRV will
; automatically restart.
; If this is set to zero, PSAPPSRV will never be recycled.
; The default value is zero.
; Dynamic change allowed for Allowed Consec Service Failures
Allowed Consec Service Failures=2
; Max Fetch Size -- max result set size in KB for a SELECT query
; Default is 5000KB. Use 0 for no limit.
Max Fetch Size=5000
; Automatically select prompt, 1 = yes, 0 = no
Auto Select Prompts=1
; This parameter is used for Tuxedo Queue Thresold Determination (used forPub/Sub
; processing only). This parameter is the actual Tuxedo message queue size.
; This is a kernel parameter in Unix. For Windows, look in BEA Tuxedo, IPC Resources.
; A value of 0 will disable Tuxedo Queue threshold Determination and usage.
; A value of -1 will use these defaults: Windows = 65535, AIX = 4000000,
; Solaris = 65535, HP = 65535
Tuxedo Queue Size=65535
[PSANALYTICSRV]
;=========================================================================
; Settings for PSANALYTICSRV
;=========================================================================
; UBBGEN settings
Min Instances=3
Max Instances=3
; Number of Analytic Instances an Analytic Server instance will load and
; unload before recycling. If the recycle count is set to zero, the
; Analytic Server will never be recycled.
; The default value is 1.
; Dynamic changes to this setting are allowed. A dynamic change will
; affect running Analytic Servers.
;Recycle Count=1
; Number of minutes an analytic instance will remain loaded without being
; accessed when it is auto-loaded by the analytic grid or when a
; PeopleCode program loads the instance with a timeout value of -1.
; The default value is 30
; Setting this to zero will disable timeouts for auto-loaded instances.
; Dynamic changes to this setting are allowed.
;Analytic Instance Idle Timeout=30
; Setting this to 1 will cause each analytic server to log to it's own
; file rather than the common PSANALYTICSRV_<Month|Day>.LOG file. The
; individual log files will include the Tuxedo server ID.
; Dynamic changes to this setting are allowed. Changes will only come
; into affect for running analytic servers when they are recycled.
; The default value is 0
;Analytic Per Server Log=1
; This setting determines what is the threshold to enable file swaping
; in ACE. Each data block is of 6K. Each data cube is divided into multiple
; data blocks. In batch environment this could be configured to a higher value.
; The default value is 1024 blocks. If set to zero, the disk swaping is disabled.
;ACE Max Memory Data Blocks=1024
; Queue size for data loading in batches. If set to zero, batch loading is disabled.
;ACE Load Queue Size=100000
[PSSAMSRV]
;=========================================================================
; Settings for PSSAMSRV
;=========================================================================
; UBBGEN settings
; PSSAMSRV never spawns, so we set Instances instead of setting a Min and
; Max value for Instances.
Min Instances=1
Max Instances=3
Service Timeout=300
; Number of services after which PSSAMSRV will automatically restart.
; If the recycle count is set to zero, PSSAMSRV will never be recycled.
; The default value is zero.
Recycle Count=100000
; Number of consecutive service failures after which PSSAMSRV will
; automatically restart.
; If this is set to zero, PSSAMSRV will never be recycled.
; The default value is zero.
Allowed Consec Service Failures=2
; Max Fetch Size -- max result set size in KB for a SELECT query
; Max Fetch Size=n indicates n * 1024 bytes
; Default is 32KB. Use 0 for no limit
Max Fetch Size=32
[PSQCKSRV]
;=========================================================================
; Settings for PSQCKSRV
;=========================================================================
; UBBGEN settings
Min Instances=1
Max Instances=3
Service Timeout=300
; Number of services after which PSQCKSRV will automatically restart.
; If the recycle count is set to zero, PSQCKSRV will never be recycled.
; The default value is zero.
Recycle Count=100000
; Number of consecutive service failures after which PSQCKSRV will
; automatically restart.
; If this is set to zero, PSQCKSRV will never be recycled.
; The default value is zero.
Allowed Consec Service Failures=2
; Max Fetch Size -- max result set size in KB for a SELECT query
; Default is 5000KB. Use 0 for no limit.
Max Fetch Size=5000
[PSQRYSRV]
;=========================================================================
; Settings for PSQRYSRV
;=========================================================================
; UBBGEN settings
Min Instances=1
Max Instances=3
Service Timeout=1200
; Number of services after which PSQRYSRV will automatically restart.
; If the recycle count is set to zero, PSQRYSRV will never be recycled.
; The default value is zero.
Recycle Count=100000
; Number of consecutive service failures after which PSQRYSRV will
; automatically restart.
; If this is set to zero, PSQRYSRV will never be recycled.
; The default value is zero.
Allowed Consec Service Failures=2
; Max Fetch Size -- max result set size in KB for a SELECT query
; Default is 10000KB. Use 0 for no limit.
Max Fetch Size=10000
; Use dirty-read(uncommitted read) for PSQRYSRV only on DB2/OS390 or SQL Server
Use dirty-read=0VP1 is an application user, not a database user.
PS is a database user, the Peoplesoft objects' owner. It is also an application user on some application.
Did you try to connect onto the database with people user through SQL*Plus ? Are you able to read PSOPRDEFN, PSVERSION, PSACCESSPRFL tables ?
What Vista version are you on ? What Oracle version ?
If you have Metalink3 access, you should read the note :
Missing or invalid version of SQL library libpsora (0,0) or (200,0) (Doc ID 608741.1)+
Nicolas. -
Hi,
I created and configured process scheduler through psadmin.exe and getting error when tried to start it......
PeopleSoft Process Scheduler Administration
1) Start a Process Scheduler Server
2) Stop a Process Scheduler Server
3) Configure a Process Scheduler Server
4) Create a Process Scheduler Server Configuration
5) Delete a Process Scheduler Server Configuration
6) Edit a Process Scheduler Configuration File
7) Import an existing Process Scheduler Configuration
8) Show Status of a Process Scheduler Server
9) Kill a Process Scheduler Server
10) Clean IPC resources of a Process Scheduler Domain
q) Quit
Command to execute (1-10, q) : 1
Database list:
1) HC
Select item number to start: 1
No Archive subdirectory, creating it...
No psprcs.cfg in the Archive subdirectory, creating it...
Installing PeopleSoft ODBC driver and Crystal libraries ...
PeopleSoft ODBC Driver installed.
Registering nVision...
PeopleSoft nVision registered.
Starting Process Scheduler Server PSNT for Database HC ...
Booting all admin and server processes in C:\PT8.49\appserv\prcs\HC\PSTUXCFG
INFO: BEA Tuxedo, Version 9.1, 32-bit, Patch Level 036
INFO: Serial #: 650522264137-2065448083901, Expiration NONE, Maxusers 1000000
INFO: Licensed to: Oracle-Peoplesoft-ISV
Booting admin processes ...
exec BBL -A :
process id=3280 ... Started.
Booting server processes ...
exec PSMSTPRC -A -- -C psprcs.cfg -CD HC -PS PSNT -A start -S PSMSTPRC :
CMDTUX_CAT:1685: ERROR: Application initialization failure
tmboot: CMDTUX_CAT:827: ERROR: Fatal error encountered; initiating user error ha
ndler
tmshutdown -y
Shutting down all admin and server processes in C:\PT8.49\appserv\prcs\HC\PSTUXC
FG
Shutting down server processes ...
Shutting down admin processes ...
Server Id = 0 Group Id = VIPUL-187A83D08 Machine = VIPUL-187A83D08:
shutdown succeeded
1 process stopped.
thanks in advance
VipulPT = 8.49
OS = Win 2003
Logs under "%PS_HOME%/appserv/prcs/HC directory"
*1)- file name = MSTRSCHDLR_1207.LOG*
PSMSTPRC.2388 (0) [12/07/09 18:23:45](0) PeopleTools Release 8.49 (WinX86) starting
PSMSTPRC.2388 (0) [12/07/09 18:23:45](0) Cache Directory being used: C:\PT8.49\appserv\prcs\HC\CACHE\CACHE\PSMSTPRC_102\
PSMSTPRC.2388 (0) [12/07/09 18:23:45](0) Server failed to start
*2)- file name = TUXLOG.120709*
181957.VIPUL-187A83D08!tmloadcf.3912.1200.-2: 12-07-2009: Tuxedo Version 9.1, 32-bit
181957.VIPUL-187A83D08!tmloadcf.3912.1200.-2: CMDTUX_CAT:879: INFO: A new file system has been created. (size = 880 512-byte blocks)
182003.VIPUL-187A83D08!tmloadcf.3912.1200.-2: CMDTUX_CAT:871: INFO: TUXCONFIG file C:\PT8.49\appserv\prcs\HC\PSTUXCFG has been created
182246.VIPUL-187A83D08!tmloadcf.3536.2376.-2: 12-07-2009: Tuxedo Version 9.1, 32-bit
182246.VIPUL-187A83D08!tmloadcf.3536.2376.-2: CMDTUX_CAT:879: INFO: A new file system has been created. (size = 880 512-byte blocks)
182252.VIPUL-187A83D08!tmloadcf.3536.2376.-2: CMDTUX_CAT:871: INFO: TUXCONFIG file C:\PT8.49\appserv\prcs\HC\PSTUXCFG has been created
182345.VIPUL-187A83D08!BBL.2052.3804.0: 12-07-2009: Tuxedo Version 9.1, 32-bit, Patch Level 036
182345.VIPUL-187A83D08!BBL.2052.3804.0: LIBTUX_CAT:262: INFO: Standard main starting
182345.VIPUL-187A83D08!PSMSTPRC.2388.892.-2: 12-07-2009: Tuxedo Version 9.1, 32-bit
182345.VIPUL-187A83D08!PSMSTPRC.2388.892.-2: LIBTUX_CAT:262: INFO: Standard main starting
182345.VIPUL-187A83D08!PSMSTPRC.2388.892.-2: LIBTUX_CAT:250: ERROR: tpsvrinit() failed
182345.VIPUL-187A83D08!tmboot.2556.3812.-2: 12-07-2009: Tuxedo Version 9.1, 32-bit
182345.VIPUL-187A83D08!tmboot.2556.3812.-2: tmboot: CMDTUX_CAT:827: ERROR: Fatal error encountered; initiating user error handler
182348.VIPUL-187A83D08!BBL.2052.3804.0: CMDTUX_CAT:26: INFO: The BBL is exiting system
File name = PSPRCS.CFG
[Startup]
;=========================================================================
; Database Signon settings
;=========================================================================
DBName=HC
DBType=MICROSFT
UserId=PS
UserPswd=sxaYMM0Crai26F3R14m0+JWdoXJsSHVovUxlKDaxFDM=
ConnectId=people
ConnectPswd=kyD3QPxnrag=
ServerName=PSNT
[Database Options]
;=========================================================================
; Database-specific configuration options
;=========================================================================
; Please see Chapter "Tuning and Administration", in
; Sybase Installation and Administration Guide for details
SybasePacketSize=512
; Please see Chapter "Tuning and Administration", in
; Oracle Installation and Administration Guide for details
UseLocalOracleDB=0
;ORACLE_SID=
OracleDisableFirstRowsHint=0
; Dynamic change allowed for EnableDBMonitoring (PSAESRV Only)
EnableDBMonitoring=1
[Trace]
;=========================================================================
; Trace settings
;=========================================================================
; PeopleTools trace file (NT only, ignored on UNIX)
TraceFile=%PS_SERVDIR%\logs\PeopleTools.trc
; SQL Tracing Bitfield
; Bit Type of tracing
; 1 - SQL statements
; 2 - SQL statement variables
; 4 - SQL connect, disconnect, commit and rollback
; 8 - Row Fetch (indicates that it occurred, not data)
; 16 - All other API calls except ssb
; 32 - Set Select Buffers (identifies the attributes of columns
; to be selected).
; 64 - Database API specific calls
; 128 - COBOL statement timings
; 256 - Sybase Bind information
; 512 - Sybase Fetch information
; 1024 - SQL Informational Trace
; Dynamic change allowed for TraceSql and TraceSqlMask
TraceSQL=0
; PeopleCode Tracing Bitfield
; Bit Type of tracing
; 1 - Trace Evaluator instructions (not recommended)
; 2 - List Evaluator program (not recommended)
; 4 - Show assignments to variables
; 8 - Show fetched values
; 16 - Show stack
; 64 - Trace start of programs
; 128 - Trace external function calls
; 256 - Trace internal function calls
; 512 - Show parameter values
; 1024 - Show function return value
; 2048 - Trace each statement in program (recommended)
; Dynamic change allowed for TracePC
TracePC=0
; AE Tracing Bitfield
; Bit Type of tracing
; 1 - Trace STEP execution sequence to AET file
; 2 - Trace Application SQL statements to AET file
; 4 - Trace Dedicated Temp Table Allocation to AET file
; 8 - not yet allocated
; 16 - not yet allocated
; 32 - not yet allocated
; 64 - not yet allocated
; 128 - Timings Report to AET file
; 256 - Method/BuiltIn detail instead of summary in AET Timings Report
; 512 - not yet allocated
; 1024 - Timings Report to tables
; 2048 - DB optimizer trace to file
; 4096 - DB optimizer trace to tables
TraceAE=0
; Performance Monitor Tracing Bitfield
; Bit Type of tracing
; 1 - Trace All performance monitor agent activity
TracePPM=0
[Process Scheduler]
;=========================================================================
; General settings for the Process Scheduler
;=========================================================================
PrcsServerName=PSNT
DBBIN=c:\Program Files\Microsoft SQL Server\80\Tools\Binn
; Max number of attempt to try reconnect to the database when the connection
; is lost
Max Reconnect Attempt=12
; Interval in seconds between attempts to reconnect
Reconnection Interval=300
; This parameter indicates the duration in minutes allotted before
; Tools' security module will timeout authenticating a process released
; by Process Scheduler. The timer starts from the time Process Scheduler
; initiates the request
Authentication Timeout=5
; This allows for dynamic changes to certain setting without having to reboot
; the domain. The settings that can be dynamically changed are: Recycle Count,
; Consecutive Service failures, Trace SQL, Trace Mask SQL, TracePC,
; Log Fence, Enable DB Monitoring, and Enable Debugging.
; These settings are further identified by the "Dynamic change allowed for .."
; comment.
Allow Dynamic Changes=N
Log/Output Directory=C:\PT8.49\appserv\prcs\HC\log_output
; Log/Output Directory Extension Option
;An optional subdirectory structure that can be appended to the
;designated Log/Output Directory.
;Additional meta-string that can be used include
;Userid: %OPRID%
;Contentid: %REPORTID%
;Process Instance: %PRCSINSTANCE%
;Database Name: %DBNAME%
;Process Name: %PRCSNAME%
;Process Type: %PRCSTYPE%
;Scheduler Server Name: %SERVER%
;Current Date: %CURRDATE%
;Current Hour: %CURRHOUR%
;Job Name: %JOBNAME%
;Job Instance: %JOBINSTANCE%
; As an example for usage, %CURRDATE%\%CURRHOUR%
Output Directory Optional Extension=
; Logging detail level
; Level Type of information
; -100 - Suppress logging
; 0 - Status information
; 1 - Critical Information
; 2 - Errors
; 3 - Informational (default)
; 4 - Tracing Level 1
; 5 - Tracing Level 2
; Dynamic change allowed for LogFence
LogFence=3 -
Take count on consecutive selections of SELECT-OPTIONS.
Hi Experts,
i am new to ABAP Development. My client has given a requirement in which i have to calculate count of Documents under
selected Document types. The Document types is to be selected in Select-options. i have to to do multiple selections in this.
But i have to take count of consecutive selections using select-options. Means for first time i will click select-options,give multiple selections and take count of documents corresponding to given Document types and save in count1.
2nd time : Now again i have to select same select-options to take count of documents of different Document Types and save in count2.
Is any event has to be triggered in this ...if yes then how.
SELECT-OPTIONS Doc_type for bkpf-blart.
select count(*) from bkpf into it_loc-wa where bkpf~blart in Doc-type.
And then i have to create a report using first count1 and second count2.
Please help me.
Regards:
Mohammed Shahab AnsariHi
Can you be more clear on the requirement please. Why do you want to get the number of documents for the document selected on the selection screen? Is your requirement to get the documents belonging to that document type and again trigger another selection screen based on that selection ?
If you just want to get the count from your selection screen and then may be try the below code.
tables: bkpf.
data: ld_count type i.
data: begin of lt_count occurs 0,
dtype type bkpf-blart,
count type i,
end of lt_count.
SELECT-OPTIONS: s_Dtype for bkpf-blart.
loop at s_dtype.
select count(*) from bkpf into ld_count where bkpf~blart = s_Dtype-low.
lt_count-dtype = s_dtype-low.
lt_count-count = ld_count.
append lt_count.
clear lt_count.
endloop.
loop at lt_count.
write: /5 lt_count-dtype, lt_count-count.
endloop.
Regards,
Vijay V -
Counting rows based on consecutive dates
I need some guidance. I have a database of drug fills from our data warehouse. There is a unique row for every drug filled. I a general rule, there is a 30 day prescription filled each month, and my research question needs me to look at consecutive months filled.
So, if I have
Name, Drug_Name, Fill_Date
John Doe, DrugX, 05-2010
John Doe, DrugX, 06-2010
John Doe, DrugX, 07-2010
John Doe, DrugX, 08-2010
Mary Jane, DrugX, 05-2010
Larry Smith, DrugX, 06-2010
Larry Smith, DrugX, 07-2010
John Doe, DrugX, 12-2010
Larry Smith, DrugX, 09-2010
Larry Smith, DrugX, 12-2010
I need to identify patients with at least 3 consecutive months of a drug – so in the case above, that would only be John Doe. I can just do a unique count per patient and look at >= 3, because then I would also pick up Larry Smith who has 4 months of prescriptions, but not 3 consecutive months.
Suggestions?
Thank for the help.
Rich
Edited by: Ricco on Oct 19, 2010 11:19 AMHi,
Whenever you have a question, please post the sample data in a form that people can use to re-create the problem and test their ideas.
For example:
CREATE TABLE table_x
( name VARCHAR2 (20)
, drug_name VARCHAR2 (10)
, fill_date DATE
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('John Doe', 'DrugX', TO_DATE ('05-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('John Doe', 'DrugX', TO_DATE ('06-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('John Doe', 'DrugX', TO_DATE ('07-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('John Doe', 'DrugX', TO_DATE ('08-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('Mary Jane', 'DrugX', TO_DATE ('05-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('Larry Smith', 'DrugX', TO_DATE ('06-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('Larry Smith', 'DrugX', TO_DATE ('07-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('John Doe', 'DrugX', TO_DATE ('12-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('Larry Smith', 'DrugX', TO_DATE ('09-2010', 'MM-YYYY'));
INSERT INTO table_x (name, drug_name, fill_date) VALUES ('Larry Smith', 'DrugX', TO_DATE ('12-2010', 'MM-YYYY'));
COMMIT;Also, post the exact output you want. In this case, it's probably very simple. It's unclear from your description, but I think you want this:
NAME DRUG_NAME
John Doe DrugX Here's one way to get those results from that data:
WITH got_month_num AS
SELECT DISTINCT name
, drug_name
, MONTHS_BETWEEN ( TRUNC (SYSDATE, 'MONTH')
, TRUNC (fill_date, 'MONTH')
) AS month_num
FROM table_x
-- WHERE ... -- Any filtering goes here
, got_group_num AS
SELECT name
, drug_name
, ROW_NUMBER () OVER ( PARTITION BY name
, drug_name
ORDER BY month_num
) - month_num AS group_num
FROM got_month_num
SELECT DISTINCT name, drug_name
FROM got_group_num
GROUP BY name, drug_name, group_num
HAVING COUNT (*) >= 3
ORDER BY name, drug_name
;I'm guessing at some things.
For example, you didn't say what role (if any) drug_name plays in this problem, and it's hard to guess since every row has the same drug_name.
I'm guessing that every distinct combination of name and drug_name is a world of its own, having nothing to do with rows that have the same name but different drug_names, or the same drug_name but different names.
This assumes that name uniquely identifies each patient.
This does not assume that there is only one row per name and drug_name in each month, or that all fill_dates are at the same point in the month.
The query above does require the fill_dates to be in consecutive calendar months. If one fill_date is January 31, 2010, and the next fill_date for the same patient and drug is March 1, 2010, then the rows are not considered to be consecutive, even though there are only 29 days between fill_dates.
Depending on your data and your requirtements, the first sub-query (got_month_num) may not be necessary.
A "group" (as defined by group_num) is a set of rows for the same patient and drug in consecutive months. If we number the months with consecutive integers in oreer by date, and number the rows with consecutive integers also in order by date, then the difference between those integers will be constant for all ros in the same group.
Edited by: Frank Kulash on Oct 19, 2010 2:48 PM -
Can anyone tell me what this error mssg means, what the severity is, and what the resolution is?
%CONST_DIAG-SP-3-HM_TEST_FAIL: Module 7 TestMacNotification consecutive failure count:5
Thanks for any feedback.Hi,
See this:
TestMacNotification Diag Test Error
Problem Symptom:
Following messages may be seen on the console :
*Mar 10 10:25:53.562: %FABRIC_INTF_ASIC-DFC9-4-FABRICCRCERRS: Fabric ASIC 0: 322 Fabric CRC error events in 100ms period
*Mar 10 10:26:31.071: %CONST_DIAG-SP-3-HM_TEST_FAIL: Module 9 TestMacNotification consecutive failure count:5
*Mar 10 10:26:31.071: %CONST_DIAG-SP-6-HM_TEST_SP_INFO: TestMacNotification[9]: last_busy_percent[33%], Tx_Rate[3077], Rx_Rate[1302]
Root Cause :
This TestMacNotification could fail if there is some issue with the bridge ASIC/data path.
One of the reason could be some corrupted packets enter the bridge asic and cause the memory buffers to get locked up.
Troubleshooting and Recommendation:
1. Check if there any Fabric CRC errors *"*FABRICCRCERRS" in the logs.
If there are Fabric CRC errors followed by TestMacNotification test failure then issue could be because of CSCto55567 , upgrade to release 12.2(33)SRE5 or higher.
2. If TestMacNotification test fails without Fabric CRC error then contact the BU, it requires complete data path debugging.
Related DDTS: CSCto55567
Hope this helps. -
Cross tab: Getting the count based on three consecutive dates
Hi All,
I have a crosstab which as Ticket_no and Date columns. here is the sample report data.
Ticket_no Date
1 1-Jan-2013
1 2-Jan-2013
1 3-Jan-2013
2 1-Jan-2013
1 1-Jan-2013
count of tickets which are raised for consecutive 3 days in a month. Here ticket_No 1 is raised for the first 3 days..so count will be 1.
Can any one help me in this case.
Thanks in advance.
Regards,
KrishnaKrishna, Bring Ticket_No as Dimension from universe,
In web I, create a variable
= Count([Ticket_No])
Maybe you are looking for
-
I'm not sure how or when it happened but whenever I click on any Firefox icon on my desktop, I get redirected to what appears to be a Mozilla Firefox page but there is a window on the screen that says "Paypal and Firefox Simple promotion!, Did you kn
-
It took my IMac 40 mins to close down this afternoon. When I restarted it I got a message that BridgeCS4 quit unexpectedly. I clicked the button submitting the problem to Apple, but CS4 won't reopen. I tried shutting down and restarting, but every ti
-
Install forms6i and report 6i on Red Hat Linux Enterprise edition 4.0.2
Dear All we want to install forms 6i and reports 6i on Red Hat linux enterprise edition 4.0.2 if any person have step by step guide pl share with me Thanks
-
I have an Iphone 5 16 gig on the Sprint network and since i've updated my ios, it now jumps in and out of cellular service. I was told that you can revert back to 8.0.0 but i can not find a way of doing that. Has anyone else experienced this problem
-
[Solved] "Version Magic" error when booting with m
Hi, I compiled kernel 2.6.16.18 and I receive the following error when booting: ide_core: version magic '2.6.16-ARCH SMP preempt 686 gcc-4.0' should be '2.6.16.18-ARCH preempt 686 gcc-4.0' amd74xx: version magic '2.6.16-ARCH SMP preempt 686 gcc-4.0'