|
Home > Archive > SQL Anywhere database > April 2005 > **one trigger** for insert update and delete
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
**one trigger** for insert update and delete
|
|
| Rony Santoso 2005-04-15, 8:23 pm |
| Dear Forum,
Using watcom SQL, is it possible to use **one trigger** for insert,update
and delete?
Let's say I wanted to make sure that user cannot insert, update or modify
table_order_item (only for **specific fields**)
if the order has been invoiced.
the trigger structure below failed.
create trigger bUpd_OrderHasBeenInv
oiced before update of oitemsid, orderid,
itemid, itemnm, qty, itemprice, itemdisc
before insert of oitemsid, orderid, itemid, itemnm, qty, itemprice,
itemdisc,
before delete of oitemsid, orderid, itemid, itemnm, qty, itemprice, itemdisc
order 3 on oitems
referencing new as new_upd old as old_upd for each row
begin
declare user_defined_excepti
on exception for SQLSTATE '99999';
declare found integer;
end;
best regardsm
rony
| |
| anil k goel 2005-04-16, 3:23 am |
| Try:
before insert, update, delete on table_name
As an example:
create trigger blah before insert, delete, update on t
for each row
begin
message current time;
end
See the help file for details on syntax.
--
-anil
Research and Development, Query Processing
iAnywhere Solutions Engineering
-------------------------------------------------------------------------
** Whitepapers, TechDocs, bug fixes are all available through the **
** iAnywhere Developer Community at http://www.ianywhere.com/developer **
-------------------------------------------------------------------------
"Rony Santoso" <rony_xg@yahoo.de> wrote in message
news:42605e01@forums
-1-dub...
> Dear Forum,
>
> Using watcom SQL, is it possible to use **one trigger** for insert,update
> and delete?
>
> Let's say I wanted to make sure that user cannot insert, update or modify
> table_order_item (only for **specific fields**)
> if the order has been invoiced.
>
> the trigger structure below failed.
> create trigger bUpd_OrderHasBeenInv
oiced before update of oitemsid,
> orderid,
> itemid, itemnm, qty, itemprice, itemdisc
> before insert of oitemsid, orderid, itemid, itemnm, qty, itemprice,
> itemdisc,
> before delete of oitemsid, orderid, itemid, itemnm, qty, itemprice,
> itemdisc
> order 3 on oitems
> referencing new as new_upd old as old_upd for each row
> begin
> declare user_defined_excepti
on exception for SQLSTATE '99999';
> declare found integer;
>
> end;
>
>
> best regardsm
> rony
>
>
>
>
| |
| Alexander Goldun 2005-04-16, 7:23 am |
| Rony Santoso wrote:
> before delete of oitemsid, orderid, itemid, itemnm, qty, itemprice, itemdisc
:)))))
Is it possible to delete only some fields, not whole record?
| |
| Breck Carter [TeamSybase] 2005-04-16, 9:23 am |
| There is no such operation as "deleting a column". You can delete a
row, or update a column. You can update a column to be zero, empty
string, or NULL... is that what you want?
Breck
On 16 Apr 2005 03:15:58 -0700, Alexander Goldun <alexgold@spamtest.ru>
wrote:
>Rony Santoso wrote:
>
>
>:)))))
>
>Is it possible to delete only some fields, not whole record?
--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/A...7/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
| |
| Alexander Goldun 2005-04-17, 11:23 am |
| Breck Carter [TeamSybase] wrote:
> There is no such operation as "deleting a column". You can delete a
I know it. It was a question to Rony suggesting trigger before delete on
columns :)
| |
| Breck Carter [TeamSybase] 2005-04-18, 3:23 am |
| On 17 Apr 2005 08:02:20 -0700, Alexander Goldun <alexgold@spamtest.ru>
wrote:
>Breck Carter [TeamSybase] wrote:
>
>I know it. It was a question to Rony suggesting trigger before delete on
>columns :)
Oops, I didn't read the signature, thought you were Rony :)
Breck
--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/A...7/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
|
|
|
|
|