Subject Re: [firebird-support] Create procedure -- newbie coming from ms sql server
Author Helen Borrie
At 04:42 AM 19/06/2003 +0000, you wrote:
>Hi,
>
> This is going to sound like a real dumb question to tou probabally.
>Firstly, my background is in ms sql server, and I have been looking
>at firebird for the first time today.
>So I manged to create a table and populate it wil data.. hooray..
>
>CREATE TABLE TBLMARTIN (
> FIELD1 SMALLINT,
> FIRSTNAME VARCHAR (50) CHARACTER SET WIN1251 COLLATE WIN1251);
>
>insert into TBLMARTIN (FIELD1,Firstname) values
>(1,'martin') /*several time*/
>
>next I wrote a simple select statement and again it worked.
>
>select FirstName from TBLMARTIN
>
>then a decieded to encapsulate my select query into a stored
>procedure. This is where I hit real problems.
>I would have expected the following to work
>
>CREATE PROCEDURE FirstProcedure
>AS
>BEGIN
> select FirstName from TBLMARTIN;
>END
>
>but it doesn't.

It does: but you haven't given it anything to do with it.

Try
CREATE PROCEDURE FirstProcedure
returns FirstName varchar(50)
AS
BEGIN
FOR select FirstName from TBLMARTIN
INTO :FirstName DO
BEGIN
/* Do what you like in here: it's a unidirectional loop */
SUSPEND; /* This returns multiple output rows */
END
END

Then
SELECT * FROM FirstProcedure

will return all of your FirstName values in a set.


>I have a million more questions about firebird and finding
>documentation is proving troublesome.
>
>Can anybody please point me to some tutorials that will help me
>accomplish tasks similar to above such as writing tiggers,udf's,
>views ect..

Go to www.ibphoenix.com:

On the Downloads > Main page, you will find Firebird Quickstart Guide
(nothing about the SQL language other than CONNECT and CREATE DATABASE)

On the Downloads > InterBase page, pick up the complete set of beta docs
for InterBase 6.0. The book you want is the Language Reference (LangRef.pdf).

There you will also find an SQL Reference document (fairly out of date but
OK for the basics) in HTML format.

Also go to the downloads area of the firebirdsql.org site and get the
release notes doc for Firebird 1. It contains all of the language features
which were added to Firebird up to and including rls 1, about a year ago.

The READMEs in the CVS tree, under ../firebird2/docs/sql.extensions/ will
give you most of what you need to know (but not quite all of what there is
to know) about language additions in 1.5.

heLen