Serge Rielau wrote:
Gregor Kova wrote: Serge Rielau wrote:
Knut Stolze wrote:
Serge Rielau wrote:
> UPDATE TABLE2 SET TS = CURRENT TIMESTAMP WHERE ID = (SELECT
>FIELD1 FROM TABLE1 WHERE FIELD2 = {GET_VALUE_FROM_INPUT});
And then the SELECT from the UPDATE wouldn't be an issue anymore...
Oh, he wants to get the id back? No problem!
SELECT id FROM OLD TABLE(UPDATE TABLE2 SET TS = CURRENT TIMESTAMP WHERE
ID = (SELECT FIELD1 FROM TABLE1 WHERE FIELD2 = {GET_VALUE_FROM_INPUT}));
Cheers
Serge
:) This is all good and OK, but like thid you loose the flexibility of
:SQL
DECLARE's, SET's and alike that you can use in SQL procedures.
What's it that you want to achieve?
The feature described above is more efficient than procedural logic.
Of course it's not the same and it isn't meant to be.
Cheers
Serge
What I want to achieve is this:
We have an application that has its input forms stored in a database. We
also have a database replication that is automatic to transfer those input
forms from our development database to our test database, but there is no
automatic replication of functions, stored procedures, database
structure, ...
So it is faster and more "under control" for me to specify a BEGIN ATOMIC
block on that input form than to create a procedure and distribute it on
two, three, ... databases. And this BEGIN ATOMIC block can also be edited
faster than stored procedures, functions, ...
And the most important thing is that in BEGIM ATOMIC block you HAVE the
flexibility of a plain stored procedure, meaning you can use DECLARE, FOR,
WHILE, ...
Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| Gregor Kovac |
Gr**********@mikropis.si |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~