Board index » delphi » Building and executing a SQL Statement

Building and executing a SQL Statement

Greetings.

 I would like to ask, if there is any way to build a
SQL statement inside a stored proc and execute it.

for example , can this pseudocode be developed:

tmpSQL = 'INSERT INTO TMP_TABLE SELECT COL1, COL2 FROM aTABLE '
:
{block of WHERE Clause building}
:
tmpSQL = tmpSQL ||  tmpWHEREClause

execute tmpSQL

{continue working with TMP_TABLE}

t.i.a.

 

Re:Building and executing a SQL Statement


"George M. Zouganelis" <NOSPAM.gz...@technologist.com> wrote in
message news:3c4d92ac.5528317@forums.inprise.com...

Quote
> Greetings.

>  I would like to ask, if there is any way to build a
> SQL statement inside a stored proc and execute it.

No. Stored procedures are pre-compiled in Interbase so dynamic
generation isn't possible at this time.

Woody

Re:Building and executing a SQL Statement


No. Stored procs are compiled when they are created so you cannot create SQL
dynamically.

--
Bill
(TeamB cannot answer questions received via email)

"George M. Zouganelis" <NOSPAM.gz...@technologist.com> wrote in message
news:3c4d92ac.5528317@forums.inprise.com...

Quote
> Greetings.

>  I would like to ask, if there is any way to build a
> SQL statement inside a stored proc and execute it.

> for example , can this pseudocode be developed:

> tmpSQL = 'INSERT INTO TMP_TABLE SELECT COL1, COL2 FROM aTABLE '
> :
> {block of WHERE Clause building}
> :
> tmpSQL = tmpSQL ||  tmpWHEREClause

> execute tmpSQL

> {continue working with TMP_TABLE}

> t.i.a.

Re:Building and executing a SQL Statement


Currently, no.

If you're using the open source version, you might want to take a look at
Firebird, the open source code fork ( www.firebirdsql.org ) -- something
like this is supported in there... Or at least, people have been/are working
on it...

--
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."

"George M. Zouganelis" <NOSPAM.gz...@technologist.com> wrote in message
news:3c4d92ac.5528317@forums.inprise.com...

Quote
> Greetings.

>  I would like to ask, if there is any way to build a
> SQL statement inside a stored proc and execute it.

> for example , can this pseudocode be developed:

> tmpSQL = 'INSERT INTO TMP_TABLE SELECT COL1, COL2 FROM aTABLE '
> :
> {block of WHERE Clause building}
> :
> tmpSQL = tmpSQL ||  tmpWHEREClause

> execute tmpSQL

> {continue working with TMP_TABLE}

> t.i.a.

Re:Building and executing a SQL Statement


many thanks you for your answers.
'hope for a better future :)

Other Threads