Subject | Re: [firebird-support] Re: How To: Write a Store Proc. for the following |
---|---|
Author | Helen Borrie |
Post date | 2004-04-20T08:10:34Z |
At 01:00 PM 20/04/2004 +0530, you wrote:
BASIC. It's really just a very simple structured language and you're
really beyond expectations if you want SQL to work as a scripting language
like VFP does.
Rather than try to "translate" your VFP, get acquainted with what you *can*
do with PSQL and standard SQL. Get hold of the IB 6 beta Language
Reference (LangRef.pdf) and get your head around the language elements you
have to work with.
Scan through the *.SQL files in your Firebird \UDF directory - there you
have SQL declarations for some external functions (with some light
documentation) that you can use for the trickier string manipulations.
Understand the difference between DDL (data definition language) and DML
(data manipulation language). Basically, language for "SQL objects you
create" (DDL) is not available in stored procedure language (PSQL). So
PSQL can't handle arguments and variables that refer to metadata. Any SQL
statements inside a SP are precompiled, so the structure of the query
specification has to be known at the time the SP is created (i.e.
"compiled" into the binary language that the engine uses at run-time).
However, in 1.5, once you actually understand SQL in general, you can use
the EXECUTE STATEMENT syntax . Then you will be able to construct
"macro-like" procedures that can be called by other procedures, if there is
any benefit to that.
You reject the option to write your own external procedures (UDFs). Is
that because you don't know any languages other than VFP? or that you
don't know how to write dynamic libraries? If you do know any programming
languages, there are HowTo's around to help you to understand how to write
external functions...
/heLen
>I am reposting this as I didn't find it in the digests.Structurally, it's a little like structured Pascal and a little like
>
>Hi Helen
>
>Thank you so much for your help. I needed this primer for writing
>SP's. My first impression is that the language is something similar to
>PASCAL? Any link where I can keep on referring in the future?
BASIC. It's really just a very simple structured language and you're
really beyond expectations if you want SQL to work as a scripting language
like VFP does.
Rather than try to "translate" your VFP, get acquainted with what you *can*
do with PSQL and standard SQL. Get hold of the IB 6 beta Language
Reference (LangRef.pdf) and get your head around the language elements you
have to work with.
Scan through the *.SQL files in your Firebird \UDF directory - there you
have SQL declarations for some external functions (with some light
documentation) that you can use for the trickier string manipulations.
Understand the difference between DDL (data definition language) and DML
(data manipulation language). Basically, language for "SQL objects you
create" (DDL) is not available in stored procedure language (PSQL). So
PSQL can't handle arguments and variables that refer to metadata. Any SQL
statements inside a SP are precompiled, so the structure of the query
specification has to be known at the time the SP is created (i.e.
"compiled" into the binary language that the engine uses at run-time).
However, in 1.5, once you actually understand SQL in general, you can use
the EXECUTE STATEMENT syntax . Then you will be able to construct
"macro-like" procedures that can be called by other procedures, if there is
any benefit to that.
You reject the option to write your own external procedures (UDFs). Is
that because you don't know any languages other than VFP? or that you
don't know how to write dynamic libraries? If you do know any programming
languages, there are HowTo's around to help you to understand how to write
external functions...
/heLen