Subject | Re: [ib-support] SP Problem |
---|---|
Author | Walter Neumann |
Post date | 2003-03-10T08:33:07Z |
Hi Lucas,
thank you for your reply.
table, EA = table for starting [Eintrittsdatum] and ending [Austrittsdatum]
dates - more then one row for one employee)
working employees today. This works with the same syntax fine. But now I wish
to know the number of working employees in a special month even if they
worked only 1 day.
the parameters. The syntax, descriebed in the sql docu didn't work (sql
error).
thank you for your reply.
> are you sure that STICHTAG2 (which seems to be the last day in month) isyes, that is it.
> what you're really looking for?
>This SP should give the number of employee, which are working (MA = employee
> Are you sure that with
>
> > WHERE :STICHTAG2 >= (SELECT MAX(EA.EINTRITTSDATUM) FROM ...
>
> there's not "Eintrittsdatum" in the 2nd view which is AFTER STICHTAG2
> (thus returning no more records)?
table, EA = table for starting [Eintrittsdatum] and ending [Austrittsdatum]
dates - more then one row for one employee)
>for both STICHTAG1 and STICHTAG2. With today the SP gives the number of
> You wrote, that before using params you used TODAY.
> For which variable did you use today?
working employees today. This works with the same syntax fine. But now I wish
to know the number of working employees in a special month even if they
worked only 1 day.
>I use IBAccess, because I use linux. I tried it, but I don't know how to pass
> What happens if you execute (and assign the params of) this procedure
> directly in any DB-tool?
the parameters. The syntax, descriebed in the sql docu didn't work (sql
error).
>It should return 4 records in my test data.
> Have a look at your records and decide which records you think should be
> returned and compare the fields with your SQL.
> Sometimes it helps to test with single SQL statements (enter all your
> WHERE -parts directly and see if they really return what you think
> they'll do).
> > > >ALTER PROCEDURE "MITARB_COUNT"
> > > >(
> > > > "STICHTAG2" TIMESTAMP,
> > > > "STICHTAG1" TIMESTAMP
> > > >)
> > > >RETURNS
> > > >(
> > > > "ANZAHL" INTEGER
> > > >)
> > > >AS
> > > >DECLARE VARIABLE MAID INT;
> > > >BEGIN
> > > > ANZAHL = 0;
> > > > FOR SELECT MA.PERSONENIDINT FROM MITARBVIEW MA
> > > > WHERE :STICHTAG2 >= (SELECT MAX(EA.EINTRITTSDATUM) FROM
> > > > MITARBEINAUSVIEW
> > > >EA
> > > > WHERE ((EA.MITARBID = MA.PERSONENIDINT)
> > > > AND ((EA.AUSTRITTSDATUM IS NULL) OR (EA.AUSTRITTSDATUM >=
> > > >
> > > >:STICHTAG1))))
> > > >
> > > > INTO :MAID
> > > > DO
> > > > BEGIN
> > > > ANZAHL = ANZAHL + 1;
> > > > END
> > > > SUSPEND;
> > > >END