PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Declaring Variables in HFSQL?
Declaring Variables in HFSQL?
Iniciado por guest, 27,may. 2015 22:08 - 6 respuestas
Publicado el 27,mayo 2015 - 22:08
Does HFSQL support the usage of declarations? For instance in SQLServer you can declare

DECLARE @iVariable INT

To make a variable. Does this same functionality appear in HFSQL? If so, what is the proper syntax for declaring them?

Thank you for reading.

-James
Publicado el 28,mayo 2015 - 15:40
James,

Not that I'm aware of. HFSQL isn't a procedural language like PL/SQL in Oracle.
Publicado el 28,mayo 2015 - 16:40
Thank you for the information Darren!

-James
Publicado el 28,mayo 2015 - 17:54
While this thread is near the top of the message board I've got another question for this forum...

Given the fact that HFSQL isn't a procedural language, does that mean looping inside a HFSQL statement isn't possible?
Publicado el 28,mayo 2015 - 18:14
James,

Don't be afraid to ask more than 1 question in a day; we're a nice bunch! We won't shout at you if you ask sensible questions :xcool:

As for your question; SQL by it's very nature is iterative. It depends what you mean by "loop". The way you could use HFSQL is to execute the query, then drop back into WLanguage and loop through the dataset that was produced by the query - something like this:

e.g.

// Execute the query HExecuteQuery(QRY_GetProds,hQueryDefault,Product.ID) // Process each row returned from the query FOR EACH QRY_GetProds . . . whatever you want to do in WLanguage . . . END
Publicado el 28,mayo 2015 - 18:31
Thanks for the friendly advice Darren! :)

Unfortunately the solution desired was specifically requested to only be via HFSQL, so no iterating with WLanguage. I meant more along the lines of what you can do in T-SQL or the like:

WHILE Boolean_is_unfulfilled
BEGIN
....
....
END

is there an analog of this process in HFSQL? Sorry for any confusion!
Publicado el 28,mayo 2015 - 21:50
Hi James,

I have been trying to understand what you are trying to achieve here... Are you looking for stored procedures ? They are available in HFSQL C/S and you whole a lot of the wlanguage functions available

Best regards