List:General Discussion« Previous MessageNext Message »
From:Martin Gainty Date:December 13 2007 2:29am
Subject:Re: Problem with a Procedure
View as plain text  
Hi Tomas

 I'll need more info so I could follow up
Do all the Tables exist in the currently selected DB?
Do all the tables have data?
Does the current user you are using to run the Procedure have the DML
permission to create/query/insert/update or execute?

M--
----- Original Message -----
From: "Tomas Hylander" <tomas.hylander@stripped>
To: "Martin Gainty" <mgainty@stripped>
Cc: <mysql@stripped>
Sent: Monday, November 26, 2007 1:38 AM
Subject: Re: Problem with a Procedure


> Hi!
> I must say I cant see how this would help me. I know the tabels isnt
> empty since when running in query browsern I get a result.
> There must be something else thats wrong..
>
> ...but thanks anyway!
> /Hylsan
>
> On Nov 23, 2007 4:43 PM, Martin Gainty <mgainty@stripped> wrote:
> >
> >  Tomas-
> >
> > I would effect a quick iterative check on the table(s) to see if they
are
> > empty e.g.
> >
> >  SELECT count(trans2.nettovikt) from trans2;
> >
> > (If recordcount>0) then
> >  SELECT SUM(trans2.nettovikt)
> >
> >  FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> >
> > (If recordcount>0) then
> >
> >  SELECT SUM(trans2.nettovikt) INTO ut_summa
> >  FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> >  WHERE trans2.transtid between 'datum1' and 'datum2'
> >
> >  (If recordcount > 0) then
> >
> >   SELECT SUM(trans2.nettovikt) INTO ut_summa
> >   FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> >   WHERE trans2.transtid between 'datum1' and 'datum2'
> >    and artikel.reservinteger='skatt'
> >
> >  (If recordcount > 0) then
> >
> >   SELECT SUM(trans2.nettovikt) INTO ut_summa
> >   FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> >   WHERE trans2.transtid between 'datum1' and 'datum2'
> >    and artikel.reservinteger='skatt'
> >   group by artikel.volympris;
> >
> > Does this help???
> >
> > Martin Gainty
> >
> > ______________________________________________
> > Disclaimer and confidentiality note
> > Everything in this e-mail and any attachments relates to the official
> > business of Sender. This transmission is of a confidential nature and
Sender
> > does not endorse distribution to any party other than intended
recipient.
> > Sender does not necessarily endorse content contained within this
> > transmission.
> >
> >
> > > Date: Fri, 23 Nov 2007 11:10:47 +0100
> > > From: tomas.hylander@stripped
> > > To: mysql@stripped
> > > Subject: Problem with a Procedure
> >
> >
> > >
> > > Hi!
> > > Hope you can help me with this one.
> > > Im trying to learn this with stored procedures and optimize my
databases.
> > > Can someone point what wrong with this?
> > >
>
> --------------------------------------------------------------------------
------------------------------------------------------------
> > >
> > > DELIMITER $$
> > >
> > > DROP PROCEDURE IF EXISTS `vagsql`.`sok` $$
> > > CREATE DEFINER=`root`@`localhost` PROCEDURE `sok`(skatt int,
> > > datum1 DATE,
> > > datum2 DATE,
> > > OUT ut_summa decimal(8,2))
> > > BEGIN
> > >
> > > SELECT SUM(trans2.nettovikt) INTO ut_summa
> > > FROM trans2 INNER JOIN artikel on trans2.artikel=artikel.artikel
> > > WHERE trans2.transtid between 'datum1' and 'datum2'
> > > and artikel.reservinteger='skatt'
> > > group by artikel.volympris;
> > >
> > > END $$
> > >
> > > DELIMITER ;
> > >
> > >
>
> --------------------------------------------------------------------------
----------------------------------------------
> > >
> > > call sok('01','2007-01-01 00:00:00', '2007-01-10 23:59:59', @out);
> > > select @out;
> > >
> > > All I get is that "No data - zero rows fetched, selected or processed"
> > >
> > > When running this in query brower everything looks ok.
> > > SELECT SUM(trans2.nettovikt) as summa FROM trans2 INNER JOIN artikel
on
> > > trans2.artikel=artikel.artikel WHERE trans2.transtid between
'2007-07-01
> > > 00:00:00' and '2007-07-02 23:59:59' and artikel.reservinteger='01'
group
> > by
> > > artikel.volympris;
> > >
> > > Im running mysql 5.1.11.
> > >
> > > Thanks in advance!
> > > /Tomas
> >
> >
> > ________________________________
> > Share life as it happens with the new Windows Live. Share now!
>

Thread
Problem with a ProcedureTomas Hylander23 Nov
  • RE: Problem with a ProcedureMartin Gainty23 Nov
    • Re: Problem with a ProcedureTomas Hylander26 Nov
  • Re: Problem with a ProcedureMartin Gainty13 Dec
    • Re: Problem with a ProcedureTomas Hylander13 Dec