Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-20 Thread Bjørn T Johansen
I am not sure why I used subselect, I just saw an example and followed it.. But now it's working as it should... Thx for all the help! :) BTJ On 9/19/05, Bjørn T Johansen wrote: CREATE OR REPLACE FUNCTION trykkStatus (pressID INTEGER) RETURNS SetOf trykkstatus_type AS ' DECLARE

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-19 Thread hubert depesz lubaczewski
On 9/19/05, Bjørn T Johansen <[EMAIL PROTECTED]> wrote: CREATE OR REPLACE FUNCTION trykkStatus (pressID INTEGER)RETURNS SetOf trykkstatus_type AS 'DECLAREorderID ordrenew.id%TYPE;tmprec trykkstatus_type%ROWTYPE;BEGINselect id into orderID from ordrenew where now() between trykkstart and pro

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-19 Thread Bjørn T Johansen
Yes, I read the doc... And I have now created this function, which seems to be ok but when I try to select from it, I get an error telling me that "subquery must return only one column". But my subquery does return only one column...? My function looks like this? CREATE OR REPLACE FUNCTION try

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-16 Thread hubert depesz lubaczewski
On 9/15/05, Bjørn T Johansen <[EMAIL PROTECTED]> wrote: Yes, I did and I found an answer... :) you did what? read the docs?  But I am trying to use this function in a report designer and the result from the select is in the way of the real data from the fetch... Is there a way around this? and? as

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-15 Thread Bjørn T Johansen
Yes, I did and I found an answer... :) But I am trying to use this function in a report designer and the result from the select is in the way of the real data from the fetch... Is there a way around this? BTJ hubert depesz lubaczewski wrote: > On 9/15/05, *Bjørn T Johansen* <[EMAIL PROTECTED]

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-15 Thread hubert depesz lubaczewski
On 9/15/05, Bjørn T Johansen <[EMAIL PROTECTED]> wrote: But this function does not do what I need it to do... I want x rows returned, butinstead I just get a stringname...Either how do I use this name or how do I return x rows? for refcursors - just use returned name in subsequent "FETCH FROM "; f

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-15 Thread Bjørn T Johansen
Oki, I found a way... begin; select trykkstatus(1,'refcurs'); (I have added one parameter to know the cursor name) fetch all from refcurs; commit; But this returns two rowsets, first one for the select and then one for the fetch, but how do I get rid of the row that is returned by the select?

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-15 Thread Bjørn T Johansen
Yes, of course But this function does not do what I need it to do... I want x rows returned, but instead I just get a stringname... Either how do I use this name or how do I return x rows? BTJ Gnanavel S wrote: > 'IF' block is not ended. > > On 9/15/05, *Bjørn T Johansen* <[EMAIL PROTECTE

Re: [GENERAL] Help trying to write my first plpgsql function...

2005-09-15 Thread Gnanavel S
'IF' block is not ended.On 9/15/05, Bjørn T Johansen <[EMAIL PROTECTED]> wrote: I am trying to write a function that returns x rows, where x >= 0 and this is what Ihave come up with...:CREATE OR REPLACE FUNCTION trykkStatus (pressID SMALLINT) RETURNS REFCURSOR AS 'declareorderID ordrenew.id%TY