[DUG] SQL 2005 express
Neven MacEwan
neven at mwk.co.nz
Fri Mar 23 15:29:56 NZST 2007
Traci
Yes in that case, (it was a simple example) but reporting against a sp
is very important where you can't
get the exact result set from a simple view or select statement (using
Crystal Reports for example)
PostgreSQL returns this by
CREATE OR REPLACE FUNCTION f_test() RETURNS SETOF tbl_mytest AS $$
DECLARE
myrec record;
BEGIN
FOR myrec IN SELECT id, foo FROM tbl_mytest LOOP
RETURN NEXT myrec;
END LOOP;
RETURN;
END;
$$ LANGUAGE 'plpgsql';
which is a little more tedoius but I do like "FOR myrec IN SELECT id,
foo FROM tbl_mytest LOOP"
which is far better than the equivalent in Transact SQL
DECLARE
@ID INT,
@Foo varchar(255)
DECLARE C Cursor LOCAL FOR
SELECT id, foo FROM tbl_mytest
OPEN C
FETCH NEXT FROM C INTO @ID, @Foo
WHILE @@FETCH_STATUS = 0 BEGIN
#do something here#
FETCH NEXT FROM C INTO @ID, @Foo
END
CLOSE C
DEALLOCATE C
Neven
> Isn't that what views are for ;-)
>
> -----Original Message-----
> From: delphi-bounces at ns3.123.net.nz [mailto:delphi-bounces at ns3.123.net.nz]
> On Behalf Of Berend de Boer
> Sent: Friday, 23 March 2007 2:44 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] SQL 2005 express
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>>>>>> "Robert" == Robert martin <rob at wildsoft.co.nz> writes:
>>>>>>
>
> Robert> Hi I haven't used the others extensively (or at all in
> Robert> some cases) but to say that selectable SPs are difficult
> Robert> in Firebird (1.5) makes me wonder. I have found FB stored
> Robert> procs very easy to write, especially select procedures.
> Robert> The others must be wonderful !
>
> MS SQL /My Sql it is simply:
>
> create procedure hello as
>
> select * from world
>
> go
>
> Almost every other dialect requires special magic as soon as you have a
> select statement inside a stored procedure.
>
> - --
> Live long and prosper,
>
> Berend de Boer
>
>
> PS: This email has been digitally signed if you wonder what the strange
> characters are that your outdated email client displays.
> PGP public key: http://www.pobox.com/~berend/berend-public-key.txt
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
>
> iD8DBQFGAz7nIyuuaiRyjTYRAq1WAKClwyTYaTp+K4tlj2dybQlcMiq8RQCdGplo
> V+zD+VyR2+SVsLrqqtO9e4U=
> =Cf0F
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.net.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.net.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
>
>
More information about the Delphi
mailing list